# Path: glanceclient/_i18n.py

# 
# Path: glanceclient/exc.py
# class BaseException(Exception):
# class CommandError(BaseException):
# class InvalidEndpoint(BaseException):
# class CommunicationError(BaseException):
# class ClientException(Exception):
# class HTTPException(ClientException):
# class HTTPMultipleChoices(HTTPException):
# class BadRequest(HTTPException):
# class HTTPBadRequest(BadRequest):
# class Unauthorized(HTTPException):
# class HTTPUnauthorized(Unauthorized):
# class Forbidden(HTTPException):
# class HTTPForbidden(Forbidden):
# class NotFound(HTTPException):
# class HTTPNotFound(NotFound):
# class HTTPMethodNotAllowed(HTTPException):
# class Conflict(HTTPException):
# class HTTPConflict(Conflict):
# class OverLimit(HTTPException):
# class HTTPOverLimit(OverLimit):
# class HTTPInternalServerError(HTTPException):
# class HTTPNotImplemented(HTTPException):
# class HTTPBadGateway(HTTPException):
# class ServiceUnavailable(HTTPException):
# class HTTPServiceUnavailable(ServiceUnavailable):
# class NoTokenLookupException(Exception):
# class EndpointNotFound(Exception):
# class SSLConfigurationError(BaseException):
# class SSLCertificateError(BaseException):
#     def __init__(self, message=None):
#     def __str__(self):
#     def __init__(self, details=None):
#     def __str__(self):
#     def __str__(self):
# def from_response(response, body=None):


import datetime
import errno
import functools
import hashlib
import json
import os
import re
import sys
import threading
import urllib.parse
import uuid
    import msvcrt  # noqa
import prettytable
import wrapt
from oslo_utils import encodeutils
from oslo_utils import strutils
from glanceclient._i18n import _
from glanceclient import exc
        return [unicode_key_value_to_string(l) for l in src]
    return _encode(src)


def print_dict(d, max_column_width=80):
    pt = prettytable.PrettyTable(['Property', 'Value'], caching=False)
    pt.align = 'l'
    pt.max_width = max_column_width
    for k, v in d.items():
        if isinstance(v, (dict, list)):
            v = json.dumps(v)
        pt.add_row([k, v])
    print(encodeutils.safe_decode(pt.get_string(sortby='Property')))


def find_resource(manager, name_or_id):
    """Helper for the _find_* methods."""
    # first try to get entity as integer id
    try:
        if isinstance(name_or_id, int) or name_or_id.isdigit():
            return manager.get(int(name_or_id))
    except exc.NotFound:
        pass

    # now try to get entity as uuid
    try:
        # This must be unicode for Python 3 compatibility.
        # If you pass a bytestring to uuid.UUID, you will get a TypeError
        uuid.UUID(encodeutils.safe_decode(name_or_id))
        return manager.get(name_or_id)

# Path: glanceclient/_i18n.py

# 
# Path: glanceclient/exc.py
# class BaseException(Exception):
# class CommandError(BaseException):
# class InvalidEndpoint(BaseException):
# class CommunicationError(BaseException):
# class ClientException(Exception):
# class HTTPException(ClientException):
# class HTTPMultipleChoices(HTTPException):
# class BadRequest(HTTPException):
# class HTTPBadRequest(BadRequest):
# class Unauthorized(HTTPException):
# class HTTPUnauthorized(Unauthorized):
# class Forbidden(HTTPException):
# class HTTPForbidden(Forbidden):
# class NotFound(HTTPException):
# class HTTPNotFound(NotFound):
# class HTTPMethodNotAllowed(HTTPException):
# class Conflict(HTTPException):
# class HTTPConflict(Conflict):
# class OverLimit(HTTPException):
# class HTTPOverLimit(OverLimit):
# class HTTPInternalServerError(HTTPException):
# class HTTPNotImplemented(HTTPException):
# class HTTPBadGateway(HTTPException):
# class ServiceUnavailable(HTTPException):
# class HTTPServiceUnavailable(ServiceUnavailable):
# class NoTokenLookupException(Exception):
# class EndpointNotFound(Exception):
# class SSLConfigurationError(BaseException):
# class SSLCertificateError(BaseException):
#     def __init__(self, message=None):
#     def __str__(self):
#     def __init__(self, details=None):
#     def __str__(self):
#     def __str__(self):
# def from_response(response, body=None):


# Path: glanceclient/common/utils.py
import datetime
import errno
import functools
import hashlib
import json
import os
import re
import sys
import threading
import urllib.parse
import uuid
    import msvcrt  # noqa
import prettytable
import wrapt
from oslo_utils import encodeutils
from oslo_utils import strutils
from glanceclient._i18n import _
from glanceclient import exc

        return [unicode_key_value_to_string(l) for l in src]
    return _encode(src)


def print_dict(d, max_column_width=80):
    pt = prettytable.PrettyTable(['Property', 'Value'], caching=False)
    pt.align = 'l'
    pt.max_width = max_column_width
    for k, v in d.items():
        if isinstance(v, (dict, list)):
            v = json.dumps(v)
        pt.add_row([k, v])
    print(encodeutils.safe_decode(pt.get_string(sortby='Property')))


def find_resource(manager, name_or_id):
    """Helper for the _find_* methods."""
    # first try to get entity as integer id
    try:
        if isinstance(name_or_id, int) or name_or_id.isdigit():
            return manager.get(int(name_or_id))
    except exc.NotFound:
        pass

    # now try to get entity as uuid
    try:
        # This must be unicode for Python 3 compatibility.
        # If you pass a bytestring to uuid.UUID, you will get a TypeError
        uuid.UUID(encodeutils.safe_decode(name_or_id))
        return manager.get(name_or_id)

    except (ValueError, exc.NotFound):