# Path: iktomi/web/url_templates.py
# def urlquote(value):
#     if isinstance(value, six.integer_types):
#         value = six.text_type(value)
#     return quote(value.encode('utf-8'))


import six
    from urlparse import urlparse, parse_qs, unquote
    from urllib.parse import urlparse, parse_qs, unquote
from webob.multidict import MultiDict
from .url_templates import urlquote
from iktomi.utils.url import uri_to_iri_parts
# -*- coding: utf-8 -*-

__all__ = ['URL']

if six.PY2:
else:# pragma: no cover; we check coverage only in python2 part


def construct_url(path, query, host, port, scheme, fragment=None):

# Path: iktomi/web/url_templates.py
# def urlquote(value):
#     if isinstance(value, six.integer_types):
#         value = six.text_type(value)
#     return quote(value.encode('utf-8'))


# Path: iktomi/web/url.py
import six
    from urlparse import urlparse, parse_qs, unquote
    from urllib.parse import urlparse, parse_qs, unquote
from webob.multidict import MultiDict
from .url_templates import urlquote
from iktomi.utils.url import uri_to_iri_parts

# -*- coding: utf-8 -*-

__all__ = ['URL']

if six.PY2:
else:# pragma: no cover; we check coverage only in python2 part


def construct_url(path, query, host, port, scheme, fragment=None):

    query = ('?' + '&'.join('{}={}'.format(urlquote(k), urlquote(v))