# Path: cherrypy/_cperror.py
# class CherryPyException(Exception):
# class TimeoutError(CherryPyException):
# class InternalRedirect(CherryPyException):
# class HTTPRedirect(CherryPyException):
# class HTTPError(CherryPyException):
# class NotFound(HTTPError):
#     def __init__(self, path, query_string=""):
#     def __init__(self, urls, status=None, encoding=None):
#     def set_response(self):
#     def __call__(self):
# def clean_headers(status):
#     def __init__(self, status=500, message=None):
#     def set_response(self):
#     def get_error_page(self, *args, **kwargs):
#     def __call__(self):
#     def __init__(self, path=None):
# def get_error_page(status, **kwargs):
# def _be_ie_unfriendly(status):
# def format_exc(exc=None):
# def bare_error(extrabody=None):
# 
# Path: cherrypy/_cpcompat.py
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
# def assert_native(n):
# def base64_decode(n, encoding='ISO-8859-1'):
#     def sorted(i):
#     def reversed(x):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def HTTPDate(timeval=None):
#     def unquote_qs(atom, encoding, errors='strict'):
#     def unquote_qs(atom, encoding, errors='strict'):
#         def json_decode(s):
#         def _json_encode(s):
#         def json_encode(value):
#     def random20():
#     def random20():
#     def next(i):
#     def __get_daemon(self):
#     def __set_daemon(self, daemon):
# class SetDaemonProperty:


import datetime
import logging
import os
import sys
import cherrypy
                import types
from cherrypy import _cperror
from cherrypy._cpcompat import ntob, py3k

        Like Apache started doing in 2.0.46, non-printable and other special
        characters in %r (and we expand that to all parts) are escaped using
        \\xhh sequences, where hh stands for the hexadecimal representation
        of the raw byte. Exceptions from this rule are " and \\, which are
        escaped by prepending a backslash, and all whitespace characters,
        which are written in their C-style notation (\\n, \\t, etc).
        """
        request = cherrypy.serving.request
        remote = request.remote
        response = cherrypy.serving.response
        outheaders = response.headers
        inheaders = request.headers
        if response.output_status is None:
            status = "-"
        else:
            status = response.output_status.split(ntob(" "), 1)[0]
            if py3k:
                status = status.decode('ISO-8859-1')

        atoms = {'h': remote.name or remote.ip,
                 'l': '-',
                 'u': getattr(request, "login", None) or "-",
                 't': self.time(),
                 'r': request.request_line,
                 's': status,
                 'b': dict.get(outheaders, 'Content-Length', '') or "-",
                 'f': dict.get(inheaders, 'Referer', ''),
                 'a': dict.get(inheaders, 'User-Agent', ''),
                 }

# Path: cherrypy/_cperror.py
# class CherryPyException(Exception):
# class TimeoutError(CherryPyException):
# class InternalRedirect(CherryPyException):
# class HTTPRedirect(CherryPyException):
# class HTTPError(CherryPyException):
# class NotFound(HTTPError):
#     def __init__(self, path, query_string=""):
#     def __init__(self, urls, status=None, encoding=None):
#     def set_response(self):
#     def __call__(self):
# def clean_headers(status):
#     def __init__(self, status=500, message=None):
#     def set_response(self):
#     def get_error_page(self, *args, **kwargs):
#     def __call__(self):
#     def __init__(self, path=None):
# def get_error_page(status, **kwargs):
# def _be_ie_unfriendly(status):
# def format_exc(exc=None):
# def bare_error(extrabody=None):
# 
# Path: cherrypy/_cpcompat.py
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
# def assert_native(n):
# def base64_decode(n, encoding='ISO-8859-1'):
#     def sorted(i):
#     def reversed(x):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def HTTPDate(timeval=None):
#     def unquote_qs(atom, encoding, errors='strict'):
#     def unquote_qs(atom, encoding, errors='strict'):
#         def json_decode(s):
#         def _json_encode(s):
#         def json_encode(value):
#     def random20():
#     def random20():
#     def next(i):
#     def __get_daemon(self):
#     def __set_daemon(self, daemon):
# class SetDaemonProperty:


# Path: cherrypy/_cplogging.py
import datetime
import logging
import os
import sys
import cherrypy
                import types
from cherrypy import _cperror
from cherrypy._cpcompat import ntob, py3k


        Like Apache started doing in 2.0.46, non-printable and other special
        characters in %r (and we expand that to all parts) are escaped using
        \\xhh sequences, where hh stands for the hexadecimal representation
        of the raw byte. Exceptions from this rule are " and \\, which are
        escaped by prepending a backslash, and all whitespace characters,
        which are written in their C-style notation (\\n, \\t, etc).
        """
        request = cherrypy.serving.request
        remote = request.remote
        response = cherrypy.serving.response
        outheaders = response.headers
        inheaders = request.headers
        if response.output_status is None:
            status = "-"
        else:
            status = response.output_status.split(ntob(" "), 1)[0]
            if py3k:
                status = status.decode('ISO-8859-1')

        atoms = {'h': remote.name or remote.ip,
                 'l': '-',
                 'u': getattr(request, "login", None) or "-",
                 't': self.time(),
                 'r': request.request_line,
                 's': status,
                 'b': dict.get(outheaders, 'Content-Length', '') or "-",
                 'f': dict.get(inheaders, 'Referer', ''),
                 'a': dict.get(inheaders, 'User-Agent', ''),
                 }

        if py3k: