# Path: tornado/escape.py
#             def _json_decode(s):
# def xhtml_escape(value):
# def xhtml_unescape(value):
# def json_encode(value):
# def json_decode(value):
# def squeeze(value):
# def url_escape(value):
#     def url_unescape(value, encoding='utf-8'):
#     def url_unescape(value, encoding='utf-8'):
#     def parse_qs_bytes(qs, keep_blank_values=False, strict_parsing=False):
# def utf8(value):
# def to_unicode(value):
# def to_basestring(value):
# def recursive_unicode(obj):
# def linkify(text, shorten=False, extra_params="",
#             require_protocol=False, permitted_protocols=["http", "https"]):
#     def make_link(m):
# def _convert_entity(m):
# def _build_unicode_map():
# _XHTML_ESCAPE_RE = re.compile('[&<>"]')
# _XHTML_ESCAPE_DICT = {'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;'}
# _UTF8_TYPES = (bytes, type(None))
# _TO_UNICODE_TYPES = (unicode, type(None))
# _BASESTRING_TYPES = (basestring, type(None))
# _URL_RE = re.compile(ur"""\b((?:([\w-]+):(/{1,3})|www[.])(?:(?:(?:[^\s&()]|&amp;|&quot;)*(?:[^!"#$%&'()*+,.:;<=>?@\[\]^`{|}~\s]))|(?:\((?:[^\s&()]|&amp;|&quot;)*\)))+)""")
# _HTML_UNICODE_MAP = _build_unicode_map()


import datetime
import logging
import logging.handlers
import re
import sys
import time
    import curses
from tornado.escape import _unicode
    _TIMEDELTA_ABBREV_DICT = dict(
        (abbrev, full) for full, abbrevs in _TIMEDELTA_ABBREVS
        for abbrev in abbrevs)

    _FLOAT_PATTERN = r'[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?'

    _TIMEDELTA_PATTERN = re.compile(
        r'\s*(%s)\s*(\w*)\s*' % _FLOAT_PATTERN, re.IGNORECASE)

    def _parse_timedelta(self, value):
        try:
            sum = datetime.timedelta()
            start = 0
            while start < len(value):
                m = self._TIMEDELTA_PATTERN.match(value, start)
                if not m:
                    raise Exception()
                num = float(m.group(1))
                units = m.group(2) or 'seconds'
                units = self._TIMEDELTA_ABBREV_DICT.get(units, units)
                sum += datetime.timedelta(**{units: num})
                start = m.end()
            return sum
        except Exception:
            raise

    def _parse_bool(self, value):
        return value.lower() not in ("false", "0", "f")

    def _parse_string(self, value):

# Path: tornado/escape.py
#             def _json_decode(s):
# def xhtml_escape(value):
# def xhtml_unescape(value):
# def json_encode(value):
# def json_decode(value):
# def squeeze(value):
# def url_escape(value):
#     def url_unescape(value, encoding='utf-8'):
#     def url_unescape(value, encoding='utf-8'):
#     def parse_qs_bytes(qs, keep_blank_values=False, strict_parsing=False):
# def utf8(value):
# def to_unicode(value):
# def to_basestring(value):
# def recursive_unicode(obj):
# def linkify(text, shorten=False, extra_params="",
#             require_protocol=False, permitted_protocols=["http", "https"]):
#     def make_link(m):
# def _convert_entity(m):
# def _build_unicode_map():
# _XHTML_ESCAPE_RE = re.compile('[&<>"]')
# _XHTML_ESCAPE_DICT = {'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;'}
# _UTF8_TYPES = (bytes, type(None))
# _TO_UNICODE_TYPES = (unicode, type(None))
# _BASESTRING_TYPES = (basestring, type(None))
# _URL_RE = re.compile(ur"""\b((?:([\w-]+):(/{1,3})|www[.])(?:(?:(?:[^\s&()]|&amp;|&quot;)*(?:[^!"#$%&'()*+,.:;<=>?@\[\]^`{|}~\s]))|(?:\((?:[^\s&()]|&amp;|&quot;)*\)))+)""")
# _HTML_UNICODE_MAP = _build_unicode_map()


# Path: tornado/options.py
import datetime
import logging
import logging.handlers
import re
import sys
import time
    import curses
from tornado.escape import _unicode

    _TIMEDELTA_ABBREV_DICT = dict(
        (abbrev, full) for full, abbrevs in _TIMEDELTA_ABBREVS
        for abbrev in abbrevs)

    _FLOAT_PATTERN = r'[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?'

    _TIMEDELTA_PATTERN = re.compile(
        r'\s*(%s)\s*(\w*)\s*' % _FLOAT_PATTERN, re.IGNORECASE)

    def _parse_timedelta(self, value):
        try:
            sum = datetime.timedelta()
            start = 0
            while start < len(value):
                m = self._TIMEDELTA_PATTERN.match(value, start)
                if not m:
                    raise Exception()
                num = float(m.group(1))
                units = m.group(2) or 'seconds'
                units = self._TIMEDELTA_ABBREV_DICT.get(units, units)
                sum += datetime.timedelta(**{units: num})
                start = m.end()
            return sum
        except Exception:
            raise

    def _parse_bool(self, value):
        return value.lower() not in ("false", "0", "f")

    def _parse_string(self, value):

        return _unicode(value)