def build_options(bits, tag_name):
    """
    Splits the tag keyword arguments into usable values.
    """

    options = {}

    for bit in bits:
        try:
            option, val = bit.split('=')
        except ValueError:
            raise TemplateSyntaxError("%s has bad or badly formed option arguments." % tag_name)

        # Backwards compatibility
        if option == 'richtext':
            option = 'safe'

        if option not in ['safe', 'template', 'language']:
            raise TemplateSyntaxError("%s received an invalid option." % tag_name)

        options.update({option: val})

    return options
dataset/ETHPy150Open bennylope/django-addendum/addendum/templatetags/addendum_tags.py/build_options/original