# Path: asn1crypto/_errors.py
# def unwrap(string, *params):
#     """
#     Takes a multi-line string and does the following:
# 
#      - dedents
#      - converts newlines with text before and after into a single line
#      - strips leading and trailing whitespace
# 
#     :param string:
#         The string to format
# 
#     :param *params:
#         Params to interpolate into the string
# 
#     :return:
#         The formatted string
#     """
# 
#     output = textwrap.dedent(string)
# 
#     # Unwrap lines, taking into account bulleted lists, ordered lists and
#     # underlines consisting of = signs
#     if output.find('\n') != -1:
#         output = re.sub('(?<=\\S)\n(?=[^ \n\t\\d\\*\\-=])', ' ', output)
# 
#     if params:
#         output = output % params
# 
#     output = output.strip()
# 
#     return output


from encodings import idna  # noqa
from ._errors import unwrap
from ._types import byte_cls, str_cls, type_name, bytes_to_list, int_types
    from urlparse import urlsplit, urlunsplit
    from urllib import (
        quote as urlquote,
        unquote as unquote_to_bytes,
    )
    from urllib.parse import (
        quote as urlquote,
        unquote_to_bytes,
        urlsplit,
        urlunsplit,
    )
import codecs
import re
import sys
the following items:

 - iri_to_uri()
 - uri_to_iri()
"""

from __future__ import unicode_literals, division, absolute_import, print_function



if sys.version_info < (3,):

else:


def iri_to_uri(value, normalize=False):
    """
    Encodes a unicode IRI into an ASCII byte string URI

    :param value:
        A unicode string of an IRI

    :param normalize:
        A bool that controls URI normalization

    :return:
        A byte string of the ASCII-encoded URI
    """

    if not isinstance(value, str_cls):

# Path: asn1crypto/_errors.py
# def unwrap(string, *params):
#     """
#     Takes a multi-line string and does the following:
# 
#      - dedents
#      - converts newlines with text before and after into a single line
#      - strips leading and trailing whitespace
# 
#     :param string:
#         The string to format
# 
#     :param *params:
#         Params to interpolate into the string
# 
#     :return:
#         The formatted string
#     """
# 
#     output = textwrap.dedent(string)
# 
#     # Unwrap lines, taking into account bulleted lists, ordered lists and
#     # underlines consisting of = signs
#     if output.find('\n') != -1:
#         output = re.sub('(?<=\\S)\n(?=[^ \n\t\\d\\*\\-=])', ' ', output)
# 
#     if params:
#         output = output % params
# 
#     output = output.strip()
# 
#     return output


# Path: asn1crypto/_iri.py
from encodings import idna  # noqa
from ._errors import unwrap
from ._types import byte_cls, str_cls, type_name, bytes_to_list, int_types
    from urlparse import urlsplit, urlunsplit
    from urllib import (
        quote as urlquote,
        unquote as unquote_to_bytes,
    )
    from urllib.parse import (
        quote as urlquote,
        unquote_to_bytes,
        urlsplit,
        urlunsplit,
    )
import codecs
import re
import sys

the following items:

 - iri_to_uri()
 - uri_to_iri()
"""

from __future__ import unicode_literals, division, absolute_import, print_function



if sys.version_info < (3,):

else:


def iri_to_uri(value, normalize=False):
    """
    Encodes a unicode IRI into an ASCII byte string URI

    :param value:
        A unicode string of an IRI

    :param normalize:
        A bool that controls URI normalization

    :return:
        A byte string of the ASCII-encoded URI
    """

    if not isinstance(value, str_cls):

        raise TypeError(unwrap(