<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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)