Adapts the given registered resource to its configured repository.

    :return: object implementing
      :class:`everest.repositories.interfaces.IRepository`.

def as_repository(resource):
    """
    Adapts the given registered resource to its configured repository.

    :return: object implementing
      :class:`everest.repositories.interfaces.IRepository`.
    """
    reg = get_current_registry()
    if IInterface in provided_by(resource):
        resource = reg.getUtility(resource, name='collection-class')
    return reg.getAdapter(resource, IRepository)