@classmethod
def ensure_type(cls, resource):
    """
        Ensure that resource is of python type 'cls'
        """
    if not isinstance(resource, cls):
        return cls(resource)
    else:
        return resource
