# Path: mezzanine/utils/deprecation.py
# def mark_safe(s):
#     from django.utils.safestring import mark_safe as django_safe
# 
#     if callable(s):
# 
#         @wraps(s)
#         def wrapper(*args, **kwargs):
#             return django_safe(s(*args, **kwargs))
# 
#         return wrapper
#     return django_safe(s)


    from html.entities import name2codepoint
    from html.parser import HTMLParser
        from html.parser import HTMLParseError
    from HTMLParser import HTMLParser, HTMLParseError
    from htmlentitydefs import name2codepoint
from mezzanine.utils.deprecation import mark_safe
    from bs4 import BeautifulSoup
    from mezzanine.core.request import current_request
    from bleach import ALLOWED_PROTOCOLS, clean
    from mezzanine.conf import settings
    from mezzanine.core import defaults
    from bs4 import BeautifulSoup
    from django.conf import settings
    from mezzanine.core.templatetags.mezzanine_tags import thumbnail
import re
@mark_safe
def escape(html):
    """
    Escapes HTML according to the rules defined by the settings
    ``RICHTEXT_FILTER_LEVEL``, ``RICHTEXT_ALLOWED_TAGS``,
    ``RICHTEXT_ALLOWED_ATTRIBUTES``, ``RICHTEXT_ALLOWED_STYLES``.
    """


    if settings.RICHTEXT_FILTER_LEVEL == defaults.RICHTEXT_FILTER_LEVEL_NONE:
        return html
    tags = settings.RICHTEXT_ALLOWED_TAGS
    attrs = settings.RICHTEXT_ALLOWED_ATTRIBUTES
    styles = settings.RICHTEXT_ALLOWED_STYLES
    if settings.RICHTEXT_FILTER_LEVEL == defaults.RICHTEXT_FILTER_LEVEL_LOW:
        tags += LOW_FILTER_TAGS
        attrs += LOW_FILTER_ATTRS
    if isinstance(attrs, tuple):
        attrs = list(attrs)
    return clean(
        html,
        tags=tags,
        attributes=attrs,
        strip=True,
        strip_comments=False,
        styles=styles,
        protocols=ALLOWED_PROTOCOLS + ["tel"],
    )



# Path: mezzanine/utils/deprecation.py
# def mark_safe(s):
#     from django.utils.safestring import mark_safe as django_safe
# 
#     if callable(s):
# 
#         @wraps(s)
#         def wrapper(*args, **kwargs):
#             return django_safe(s(*args, **kwargs))
# 
#         return wrapper
#     return django_safe(s)


# Path: mezzanine/utils/html.py
    from html.entities import name2codepoint
    from html.parser import HTMLParser
        from html.parser import HTMLParseError
    from HTMLParser import HTMLParser, HTMLParseError
    from htmlentitydefs import name2codepoint
from mezzanine.utils.deprecation import mark_safe
    from bs4 import BeautifulSoup
    from mezzanine.core.request import current_request
    from bleach import ALLOWED_PROTOCOLS, clean
    from mezzanine.conf import settings
    from mezzanine.core import defaults
    from bs4 import BeautifulSoup
    from django.conf import settings
    from mezzanine.core.templatetags.mezzanine_tags import thumbnail
import re

@mark_safe
def escape(html):
    """
    Escapes HTML according to the rules defined by the settings
    ``RICHTEXT_FILTER_LEVEL``, ``RICHTEXT_ALLOWED_TAGS``,
    ``RICHTEXT_ALLOWED_ATTRIBUTES``, ``RICHTEXT_ALLOWED_STYLES``.
    """


    if settings.RICHTEXT_FILTER_LEVEL == defaults.RICHTEXT_FILTER_LEVEL_NONE:
        return html
    tags = settings.RICHTEXT_ALLOWED_TAGS
    attrs = settings.RICHTEXT_ALLOWED_ATTRIBUTES
    styles = settings.RICHTEXT_ALLOWED_STYLES
    if settings.RICHTEXT_FILTER_LEVEL == defaults.RICHTEXT_FILTER_LEVEL_LOW:
        tags += LOW_FILTER_TAGS
        attrs += LOW_FILTER_ATTRS
    if isinstance(attrs, tuple):
        attrs = list(attrs)
    return clean(
        html,
        tags=tags,
        attributes=attrs,
        strip=True,
        strip_comments=False,
        styles=styles,
        protocols=ALLOWED_PROTOCOLS + ["tel"],
    )



@mark_safe