@classmethod
def unpack_scope(cls, scope):
    """Unpacks the response from a scope function. The function should return
        either a query, a query and a projection, or a query a projection and
        an query options hash."""
    query = {}
    projection = {}
    options = {}
    if isinstance(scope, tuple):
        if len(scope) > 3:
            raise ValueError('Invalid scope')
        if len(scope) >= 1:
            query = scope[0]
        if len(scope) >= 2:
            projection = scope[1]
        if len(scope) == 3:
            options = scope[2]
    elif isinstance(scope, dict):
        query = scope
    else:
        raise ValueError('Invalid scope')
    return query, projection, options
