def flair_template_sync(self, editable, limit,
                            static, sort, use_css, use_text):
        if not use_text and not use_css:
            raise Exception('At least one of use_text or use_css must be True')
        sorts = ('alpha', 'size')
        if sort not in sorts:
            raise Exception('Sort must be one of: {}'.format(', '.join(sorts)))
        counter = {}
        if static:
            for key in static:
                if use_css and use_text:
                    parts = tuple(x.strip() for x in key.split(','))
                    if len(parts) != 2:
                        raise Exception('--static argument {!r} must have two '
                                        'parts (comma separated) when using '
                                        'both text and css.'.format(parts))
                    key = parts
                counter[key] = limit
        if self.verbose:
            sys.stdout.write('Retrieving current flair\n')
            sys.stdout.flush()
        for flair in self.current_flair():
            if self.verbose:
                sys.stdout.write('.')
                sys.stdout.flush()
            if use_text and use_css:
                key = (flair['flair_text'], flair['flair_css_class'])
            elif use_text:
                key = flair['flair_text']
            else:
                key = flair['flair_css_class']
            if key in counter:
                counter[key] += 1
            else:
                counter[key] = 1
        if self.verbose:
            print()
        if sort == 'alpha':
            items = sorted(counter.items())
        else:
            items = sorted(counter.items(), key=lambda x: x[1], reverse=True)
        if self.verbose:
            print('Clearing current flair templates')
        self.sub.flair.templates.clear()
        for key, count in items:
            if not key or count < limit:
                print('a')
                continue
            if use_text and use_css:
                text, css = key
            elif use_text:
                text, css = key, ''
            else:
                text, css = '', key
            if self.verbose:
                print('Adding template: text: {!r} css: {!r}'
                      .format(text, css))
            self.sub.flair.templates.add(text, css, editable)