def flair_template_sync(self, editable, limit,  # pylint: disable=R0912
                            static, sort, use_css, use_text):
        """Synchronize templates with flair that already exists on the site.

        :param editable: Indicates that all the options should be editable.
        :param limit: The minimum number of users that must share the flair
            before it is added as a template.
        :param static: A list of flair templates that will always be added.
        :param sort: The order to sort the flair templates.
        :param use_css: Include css in the templates.
        :param use_text: Include text in the templates.

        """
        # Parameter verification
        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)))

        # Build current flair list along with static values
        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()

        # Sort flair list items according to the specified sort
        if sort == 'alpha':
            items = sorted(counter.items())
        else:
            items = sorted(counter.items(), key=lambda x: x[1], reverse=True)

        # Clear current templates and store flair according to the sort
        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)
Synchronize templates with flair that already exists on the site.

        :param editable: Indicates that all the options should be editable.
        :param limit: The minimum number of users that must share the flair
            before it is added as a template.
        :param static: A list of flair templates that will always be added.
        :param sort: The order to sort the flair templates.
        :param use_css: Include css in the templates.
        :param use_text: Include text in the templates.