# Path: smc/base/decorators.py
# class cached_property(object):
#     """
#     Use for caching a property value on the instance. If the
#     attribute is deleted, it will be recreated when called.
#     """
# 
#     def __init__(self, func):
#         self.func = func
#         #self.__doc__ = func.__doc__
# 
#     def __get__(self, obj, cls):
#         if obj is None:
#             return self
#         value = obj.__dict__[self.func.__name__] = self.func(obj)
#         return value
# 
# class classproperty(object):
#     """
#     Used for collection manager so objects can be accessed as a
#     class property and also from the instance
#     """
# 
#     def __init__(self, fget):
#         self.fget = fget
# 
#     def __get__(self, instance, owner_cls):
#         return self.fget(owner_cls)
# 
# Path: smc/api/exceptions.py
# class FetchElementFailed(SMCException):
#     """
#     Failure when fetching results
#     """
# 
# class InvalidSearchFilter(SMCException):
#     """
#     Thrown by collections when using invalid search sequences.
#     """
# 
# Path: smc/api/common.py
# def entry_point():
#     return _get_session().entry_points


import re
import copy
import smc.base.model
from itertools import islice
from smc.base.decorators import cached_property, classproperty
from smc.api.exceptions import FetchElementFailed, InvalidSearchFilter
from smc.api.common import entry_point
    """
    def __init__(self, href, cls):
        self.href = href
        self.cls = cls
        self._result_cache = None
        
    def __iter__(self):
        self._fetch_all()
        return iter(self._result_cache)
    
    def __getitem__(self, key):
        return self._result_cache[key]
    
    def _load_from_engine(self, engine, reference):
        resources = []
        for r in engine.data.get(reference, []):
            for _, data in r.items():    
                cache = smc.base.model.ElementCache(data)
                res = self.cls(
                    name=cache.get('name'),
                    href=cache.get_link('self'),
                    type=cache.type)
                res.data = cache
                res._engine = engine
                resources.append(res)
        self._result_cache = resources
    
    def _fetch_all(self):
        if self._result_cache is None:
            results = smc.base.model.prepared_request(

# Path: smc/base/decorators.py
# class cached_property(object):
#     """
#     Use for caching a property value on the instance. If the
#     attribute is deleted, it will be recreated when called.
#     """
# 
#     def __init__(self, func):
#         self.func = func
#         #self.__doc__ = func.__doc__
# 
#     def __get__(self, obj, cls):
#         if obj is None:
#             return self
#         value = obj.__dict__[self.func.__name__] = self.func(obj)
#         return value
# 
# class classproperty(object):
#     """
#     Used for collection manager so objects can be accessed as a
#     class property and also from the instance
#     """
# 
#     def __init__(self, fget):
#         self.fget = fget
# 
#     def __get__(self, instance, owner_cls):
#         return self.fget(owner_cls)
# 
# Path: smc/api/exceptions.py
# class FetchElementFailed(SMCException):
#     """
#     Failure when fetching results
#     """
# 
# class InvalidSearchFilter(SMCException):
#     """
#     Thrown by collections when using invalid search sequences.
#     """
# 
# Path: smc/api/common.py
# def entry_point():
#     return _get_session().entry_points


# Path: smc/base/collection.py
import re
import copy
import smc.base.model
from itertools import islice
from smc.base.decorators import cached_property, classproperty
from smc.api.exceptions import FetchElementFailed, InvalidSearchFilter
from smc.api.common import entry_point

    """
    def __init__(self, href, cls):
        self.href = href
        self.cls = cls
        self._result_cache = None
        
    def __iter__(self):
        self._fetch_all()
        return iter(self._result_cache)
    
    def __getitem__(self, key):
        return self._result_cache[key]
    
    def _load_from_engine(self, engine, reference):
        resources = []
        for r in engine.data.get(reference, []):
            for _, data in r.items():    
                cache = smc.base.model.ElementCache(data)
                res = self.cls(
                    name=cache.get('name'),
                    href=cache.get_link('self'),
                    type=cache.type)
                res.data = cache
                res._engine = engine
                resources.append(res)
        self._result_cache = resources
    
    def _fetch_all(self):
        if self._result_cache is None:
            results = smc.base.model.prepared_request(

                FetchElementFailed,