# Path: soco/exceptions.py
# class DIDLMetadataError(CannotCreateDIDLMetadata):
# 
#     """Raised if a data container class cannot create the DIDL metadata due to
#     missing information.
# 
#     For backward compatibility, this is currently a subclass of
#     `CannotCreateDIDLMetadata`. In a future version, it will likely become
#     a direct subclass of `SoCoException`.
#     """
# 
# Path: soco/utils.py
# def really_unicode(in_string):
#     """Make a string unicode. Really.
# 
#     Ensure ``in_string`` is returned as unicode through a series of
#     progressively relaxed decodings.
# 
#     Args:
#         in_string (str): The string to convert.
# 
#     Returns:
#         str: Unicode.
# 
#     Raises:
#         ValueError
#     """
#     if isinstance(in_string, bytes):
#         for args in (("utf-8",), ("latin-1",), ("ascii", "replace")):
#             try:
#                 # pylint: disable=star-args
#                 in_string = in_string.decode(*args)
#                 break
#             except UnicodeDecodeError:
#                 continue
#     if not isinstance(in_string, str):
#         raise ValueError("%s is not a string at all." % in_string)
#     return in_string
# 
# def first_cap(string):
#     """Return upper cased first character"""
#     return string[0].upper() + string[1:]


import textwrap
import warnings
from .exceptions import DIDLMetadataError
from .utils import really_unicode, first_cap
from .xml import XML, ns_tag
from .data_structure_quirks import apply_resource_quirks
            from . import data_structures_entry
        self._metadata = {
            "item_list": list(items),
            "number_returned": number_returned,
            "total_matches": total_matches,
            "update_id": update_id,
        }

    def __getitem__(self, key):
        """Legacy get metadata by string key or list item(s) by index.

        .. deprecated:: 0.8

            This overriding form of __getitem__ will be removed in the 3rd
            release after 0.8. The metadata can be fetched via the named
            attributes.
        """
        if key in self._metadata:
            if key == "item_list":
                message = """
                Calling [\'item_list\'] on search results to obtain the objects
                is no longer necessary, since the object returned from searches
                now is a list. This deprecated way of getting the items will
                be removed from the third release after 0.8."""
            else:
                message = """
                Getting metadata items by indexing the search result like a
                dictionary [\'{0}\'] is deprecated. Please use the named
                attribute {1}.{0} instead. The deprecated way of retrieving the
                metadata will be removed from the third release after
                0.8""".format(

# Path: soco/exceptions.py
# class DIDLMetadataError(CannotCreateDIDLMetadata):
# 
#     """Raised if a data container class cannot create the DIDL metadata due to
#     missing information.
# 
#     For backward compatibility, this is currently a subclass of
#     `CannotCreateDIDLMetadata`. In a future version, it will likely become
#     a direct subclass of `SoCoException`.
#     """
# 
# Path: soco/utils.py
# def really_unicode(in_string):
#     """Make a string unicode. Really.
# 
#     Ensure ``in_string`` is returned as unicode through a series of
#     progressively relaxed decodings.
# 
#     Args:
#         in_string (str): The string to convert.
# 
#     Returns:
#         str: Unicode.
# 
#     Raises:
#         ValueError
#     """
#     if isinstance(in_string, bytes):
#         for args in (("utf-8",), ("latin-1",), ("ascii", "replace")):
#             try:
#                 # pylint: disable=star-args
#                 in_string = in_string.decode(*args)
#                 break
#             except UnicodeDecodeError:
#                 continue
#     if not isinstance(in_string, str):
#         raise ValueError("%s is not a string at all." % in_string)
#     return in_string
# 
# def first_cap(string):
#     """Return upper cased first character"""
#     return string[0].upper() + string[1:]


# Path: soco/data_structures.py
import textwrap
import warnings
from .exceptions import DIDLMetadataError
from .utils import really_unicode, first_cap
from .xml import XML, ns_tag
from .data_structure_quirks import apply_resource_quirks
            from . import data_structures_entry

        self._metadata = {
            "item_list": list(items),
            "number_returned": number_returned,
            "total_matches": total_matches,
            "update_id": update_id,
        }

    def __getitem__(self, key):
        """Legacy get metadata by string key or list item(s) by index.

        .. deprecated:: 0.8

            This overriding form of __getitem__ will be removed in the 3rd
            release after 0.8. The metadata can be fetched via the named
            attributes.
        """
        if key in self._metadata:
            if key == "item_list":
                message = """
                Calling [\'item_list\'] on search results to obtain the objects
                is no longer necessary, since the object returned from searches
                now is a list. This deprecated way of getting the items will
                be removed from the third release after 0.8."""
            else:
                message = """
                Getting metadata items by indexing the search result like a
                dictionary [\'{0}\'] is deprecated. Please use the named
                attribute {1}.{0} instead. The deprecated way of retrieving the
                metadata will be removed from the third release after
                0.8""".format(

                    key, self.__class__.__name__