# Path: bustard/constants.py
# TEMPLATE_BUILTIN_FUNC_WHITELIST = (
#     'all',
#     'unicode',
#     'isinstance',
#     'dict',
#     'format',
#     'repr',
#     'sorted',
#     'list',
#     'iter',
#     'round',
#     'cmp',
#     'set',
#     'bytes',
#     'reduce',
#     'slice',
#     'sum',
#     'getattr',
#     'abs',
#     'hash',
#     'len',
#     'ord',
#     'filter',
#     'range',
#     'pow',
#     'float',
#     'divmod',
#     'enumerate',
#     'basestring',
#     'zip',
#     'hex',
#     'long',
#     'next',
#     'chr',
#     'xrange',
#     'type',
#     'tuple',
#     'reversed',
#     'hasattr',
#     'delattr',
#     'setattr',
#     'str',
#     'int',
#     'unichr',
#     'min',
#     'any',
#     'complex',
#     'bool',
#     'map',
#     'max',
#     'object',
#     'callable',
# )
# 
# Path: bustard/utils.py
# def to_text(st, encoding='utf-8'):
#     if isinstance(st, str):
#         return st
#     elif isinstance(st, collections.ByteString):
#         return st.decode(encoding)
#     else:
#         return str(st)


import builtins
import os
import re
from .constants import TEMPLATE_BUILTIN_FUNC_WHITELIST
from .utils import to_text
        text = text.replace(start, '', 1)
        text = text.replace(end, '', 1)
        return text

    def cleanup_extra_whitespaces(self, text):
        """cleanup extra whitespaces let numbers of whitespaces <=1"""
        return re.sub(r'(\s)\s+', r'\1', text)


class NoEscapedText:

    def __init__(self, raw_text):
        self.raw_text = raw_text


html_escape_table = {
    '&': '&amp;',
    '"': '&quot;',
    '\'': '&apos;',
    '>': '&gt;',
    '<': '&lt;',
}


def html_escape(text):
    return ''.join(html_escape_table.get(c, c) for c in text)


def escape(text):
    if isinstance(text, NoEscapedText):

# Path: bustard/constants.py
# TEMPLATE_BUILTIN_FUNC_WHITELIST = (
#     'all',
#     'unicode',
#     'isinstance',
#     'dict',
#     'format',
#     'repr',
#     'sorted',
#     'list',
#     'iter',
#     'round',
#     'cmp',
#     'set',
#     'bytes',
#     'reduce',
#     'slice',
#     'sum',
#     'getattr',
#     'abs',
#     'hash',
#     'len',
#     'ord',
#     'filter',
#     'range',
#     'pow',
#     'float',
#     'divmod',
#     'enumerate',
#     'basestring',
#     'zip',
#     'hex',
#     'long',
#     'next',
#     'chr',
#     'xrange',
#     'type',
#     'tuple',
#     'reversed',
#     'hasattr',
#     'delattr',
#     'setattr',
#     'str',
#     'int',
#     'unichr',
#     'min',
#     'any',
#     'complex',
#     'bool',
#     'map',
#     'max',
#     'object',
#     'callable',
# )
# 
# Path: bustard/utils.py
# def to_text(st, encoding='utf-8'):
#     if isinstance(st, str):
#         return st
#     elif isinstance(st, collections.ByteString):
#         return st.decode(encoding)
#     else:
#         return str(st)


# Path: bustard/template.py
import builtins
import os
import re
from .constants import TEMPLATE_BUILTIN_FUNC_WHITELIST
from .utils import to_text

        text = text.replace(start, '', 1)
        text = text.replace(end, '', 1)
        return text

    def cleanup_extra_whitespaces(self, text):
        """cleanup extra whitespaces let numbers of whitespaces <=1"""
        return re.sub(r'(\s)\s+', r'\1', text)


class NoEscapedText:

    def __init__(self, raw_text):
        self.raw_text = raw_text


html_escape_table = {
    '&': '&amp;',
    '"': '&quot;',
    '\'': '&apos;',
    '>': '&gt;',
    '<': '&lt;',
}


def html_escape(text):
    return ''.join(html_escape_table.get(c, c) for c in text)


def escape(text):
    if isinstance(text, NoEscapedText):

        return to_text(text.raw_text)