# Path: aeriscloud/utils.py
# def memoized(func):
#     _cache = {}
# 
#     def _deco(*args, **kwargs):
#         if 'clear_cache' in kwargs or 'clear_cache_only' in kwargs:
#             _cache.clear()
#             if 'clear_cache_only' in kwargs:
#                 return  # we don't care about the output
#             del kwargs['clear_cache']
#         if not isinstance(args, collections.Hashable):
#             return func(*args, **kwargs)
#         if args in _cache:
#             return _cache[args]
#         else:
#             value = func(*args, **kwargs)
#             _cache[args] = value
#             return value
# 
#     return update_wrapper(_deco, func)


from sh import Command, CommandNotFound, ErrorReturnCode_1
from .utils import memoized
import re
    of the functions in this lib
    """
    def __init__(self, vm_name):
        msg = 'Virtual Machine "%s" does not exists' % vm_name
        super(Exception, self).__init__(msg)


class HDDNotFound(Exception):
    """
    Thrown when an invalid hdd uuid is provided to one
    of the functions in this lib
    """
    def __init__(self, uuid):
        msg = 'Virtual Hard Drive "%s" does not exists' % uuid
        super(Exception, self).__init__(msg)


class InvalidState(Exception):
    pass

_vbm = None


def VBoxManage(*args, **kwargs):
    global _vbm
    if not _vbm:
        _vbm = Command('VBoxManage')
    return _vbm(*args, **kwargs)



# Path: aeriscloud/utils.py
# def memoized(func):
#     _cache = {}
# 
#     def _deco(*args, **kwargs):
#         if 'clear_cache' in kwargs or 'clear_cache_only' in kwargs:
#             _cache.clear()
#             if 'clear_cache_only' in kwargs:
#                 return  # we don't care about the output
#             del kwargs['clear_cache']
#         if not isinstance(args, collections.Hashable):
#             return func(*args, **kwargs)
#         if args in _cache:
#             return _cache[args]
#         else:
#             value = func(*args, **kwargs)
#             _cache[args] = value
#             return value
# 
#     return update_wrapper(_deco, func)


# Path: aeriscloud/virtualbox.py
from sh import Command, CommandNotFound, ErrorReturnCode_1
from .utils import memoized
import re

    of the functions in this lib
    """
    def __init__(self, vm_name):
        msg = 'Virtual Machine "%s" does not exists' % vm_name
        super(Exception, self).__init__(msg)


class HDDNotFound(Exception):
    """
    Thrown when an invalid hdd uuid is provided to one
    of the functions in this lib
    """
    def __init__(self, uuid):
        msg = 'Virtual Hard Drive "%s" does not exists' % uuid
        super(Exception, self).__init__(msg)


class InvalidState(Exception):
    pass

_vbm = None


def VBoxManage(*args, **kwargs):
    global _vbm
    if not _vbm:
        _vbm = Command('VBoxManage')
    return _vbm(*args, **kwargs)



@memoized