# Path: tornado/log.py
# def _stderr_supports_color():
#     def __init__(self, color=True, *args, **kwargs):
#     def format(self, record):
# def enable_pretty_logging(options=None):
# def define_logging_options(options=None):
# class LogFormatter(logging.Formatter):
# 
# Path: tornado/util.py
# def b(s):
#     return s.encode('latin1')
# 
# class ObjectDict(dict):
#     """Makes a dictionary behave like an object."""
#     def __getattr__(self, name):
#         try:
#             return self[name]
#         except KeyError:
#             raise AttributeError(name)
# 
#     def __setattr__(self, name, value):
#         self[name] = value


import urllib
import re
    import doctest
from tornado.escape import native_str, parse_qs_bytes, utf8
from tornado.log import gen_log
from tornado.util import b, ObjectDict
    """
    if content_type.startswith("application/x-www-form-urlencoded"):
        uri_arguments = parse_qs_bytes(native_str(body))
        for name, values in uri_arguments.iteritems():
            values = [v for v in values if v]
            if values:
                arguments.setdefault(name, []).extend(values)
    elif content_type.startswith("multipart/form-data"):
        fields = content_type.split(";")
        for field in fields:
            k, sep, v = field.strip().partition("=")
            if k == "boundary" and v:
                parse_multipart_form_data(utf8(v), body, arguments, files)
                break
        else:
            gen_log.warning("Invalid multipart/form-data")


def parse_multipart_form_data(boundary, data, arguments, files):
    """Parses a multipart/form-data body.

    The boundary and data parameters are both byte strings.
    The dictionaries given in the arguments and files parameters
    will be updated with the contents of the body.
    """
    # The standard allows for the boundary to be quoted in the header,
    # although it's rare (it happens at least for google app engine
    # xmpp).  I think we're also supposed to handle backslash-escapes
    # here but I'll save that until we see a client that uses them
    # in the wild.

# Path: tornado/log.py
# def _stderr_supports_color():
#     def __init__(self, color=True, *args, **kwargs):
#     def format(self, record):
# def enable_pretty_logging(options=None):
# def define_logging_options(options=None):
# class LogFormatter(logging.Formatter):
# 
# Path: tornado/util.py
# def b(s):
#     return s.encode('latin1')
# 
# class ObjectDict(dict):
#     """Makes a dictionary behave like an object."""
#     def __getattr__(self, name):
#         try:
#             return self[name]
#         except KeyError:
#             raise AttributeError(name)
# 
#     def __setattr__(self, name, value):
#         self[name] = value


# Path: tornado/httputil.py
import urllib
import re
    import doctest
from tornado.escape import native_str, parse_qs_bytes, utf8
from tornado.log import gen_log
from tornado.util import b, ObjectDict

    """
    if content_type.startswith("application/x-www-form-urlencoded"):
        uri_arguments = parse_qs_bytes(native_str(body))
        for name, values in uri_arguments.iteritems():
            values = [v for v in values if v]
            if values:
                arguments.setdefault(name, []).extend(values)
    elif content_type.startswith("multipart/form-data"):
        fields = content_type.split(";")
        for field in fields:
            k, sep, v = field.strip().partition("=")
            if k == "boundary" and v:
                parse_multipart_form_data(utf8(v), body, arguments, files)
                break
        else:
            gen_log.warning("Invalid multipart/form-data")


def parse_multipart_form_data(boundary, data, arguments, files):
    """Parses a multipart/form-data body.

    The boundary and data parameters are both byte strings.
    The dictionaries given in the arguments and files parameters
    will be updated with the contents of the body.
    """
    # The standard allows for the boundary to be quoted in the header,
    # although it's rare (it happens at least for google app engine
    # xmpp).  I think we're also supposed to handle backslash-escapes
    # here but I'll save that until we see a client that uses them
    # in the wild.

    if boundary.startswith(b('"')) and boundary.endswith(b('"')):