# Path: tabun_api/compat.py
# PY2 = sys.version_info.major == 2


import re
import sys
import time
import random
import logging
import platform
import mimetypes
import lxml
import lxml.html
import lxml.etree
import iso8601
    import warnings
        import Image
        import imp
        import importlib
        import importlib.util
    import socks
from hashlib import md5
from .compat import text, text_types, binary, urequest, PY2, BaseCookie
        from PIL import Image
    from io import BytesIO
        from urlparse import urlparse
        from urllib.parse import urlparse

    context = {
        'system': platform.system() or 'NA',
        'machine': platform.machine() or 'NA',
        'release': platform.release() or 'NA',
        'pyi': platform.python_implementation() or 'Python',
        'pyv': platform.python_version(),
        'pyiv': platform.python_version(),
        'urv': urequest.__version__,
    }
    if context['pyi'] == 'PyPy':
        context['pyiv'] = '{}.{}.{}'.format(
            sys.pypy_version_info.major,
            sys.pypy_version_info.minor,
            sys.pypy_version_info.micro,
        )
        if sys.pypy_version_info.releaselevel != 'final':
            context['pyiv'] = context['pyiv'] + sys.pypy_version_info.releaselevel

    return '({system} {machine} {release}) Python/{pyv} {pyi}/{pyiv} urllib/{urv}'.format(**context)


def get_cookies_dict(headers):
    """Возвращает словарь с печеньками, взятыми из HTTP-заголовков ``Set-Cookie``.
    Ключи и значения — Unicode-строки (``unicode`` в Python 2, ``str`` в Python 3).

    :param http.client.HTTPMessage headers: объект с HTTP-заголовками
    :rtype: dict
    """


# Path: tabun_api/compat.py
# PY2 = sys.version_info.major == 2


# Path: tabun_api/utils.py
import re
import sys
import time
import random
import logging
import platform
import mimetypes
import lxml
import lxml.html
import lxml.etree
import iso8601
    import warnings
        import Image
        import imp
        import importlib
        import importlib.util
    import socks
from hashlib import md5
from .compat import text, text_types, binary, urequest, PY2, BaseCookie
        from PIL import Image
    from io import BytesIO
        from urlparse import urlparse
        from urllib.parse import urlparse


    context = {
        'system': platform.system() or 'NA',
        'machine': platform.machine() or 'NA',
        'release': platform.release() or 'NA',
        'pyi': platform.python_implementation() or 'Python',
        'pyv': platform.python_version(),
        'pyiv': platform.python_version(),
        'urv': urequest.__version__,
    }
    if context['pyi'] == 'PyPy':
        context['pyiv'] = '{}.{}.{}'.format(
            sys.pypy_version_info.major,
            sys.pypy_version_info.minor,
            sys.pypy_version_info.micro,
        )
        if sys.pypy_version_info.releaselevel != 'final':
            context['pyiv'] = context['pyiv'] + sys.pypy_version_info.releaselevel

    return '({system} {machine} {release}) Python/{pyv} {pyi}/{pyiv} urllib/{urv}'.format(**context)


def get_cookies_dict(headers):
    """Возвращает словарь с печеньками, взятыми из HTTP-заголовков ``Set-Cookie``.
    Ключи и значения — Unicode-строки (``unicode`` в Python 2, ``str`` в Python 3).

    :param http.client.HTTPMessage headers: объект с HTTP-заголовками
    :rtype: dict
    """


    cook = BaseCookie()