human
Complete the below
@register.filter(is_safe=True)
def markdown(value, arg=''):

    ''''Runs Markdown over a given value, optionally using various
    extensions python-markdown supports.
    Syntax::
    {{ value|markdown2:"extension1_name,extension2_name..." }}
    To enable safe mode, which strips raw HTML and only returns HTML
    generated by actual Markdown syntax, pass "safe" as the first
    extension in the list.
    If the version of Markdown in use does not support extensions,
    they will be silently ignored.'
    '''
assistant
#Here is the Python program you requested.
    try:
        import markdown2
    except ImportError:
        logging.warning('Markdown    package    not    installed.')
        return force_text(value)
    else:
        def parse_extra(extra):
            if (':' not in extra):
                return (extra, {})
            (name, values) = extra.split(':', 1)
            values = dict(((str(val.strip()), True) for val in values.split('|')))
            return (name.strip(), values)
        extras = (e.strip() for e in arg.split(','))
        extras = dict((parse_extra(e) for e in extras if e))
        if ('safe' in extras):
            del extras['safe']
            safe_mode = True
        else:
            safe_mode = False
        return mark_safe(markdown2.markdown(force_text(value), extras=extras, safe_mode=safe_mode))