def METHOD_NAME(obj, source='db'):
    """Replaces record refs in obj by bypassing HTTP requests.
    Any reference URI that comes from the same server and references a resource
    will be resolved directly either from the database or from Elasticsearch.
    :param obj:
        Dict-like object for which '$ref' fields are recursively replaced.
    :param source:
        List of sources from which to resolve the references. It can be any of:
            * 'db' - resolve from Database
            * 'es' - resolve from Elasticsearch
            * 'http' - force using HTTP
    :returns:
        The same obj structure with the '$ref' fields replaced with the object
        available at the given URI.
    """
    loaders = {
        'db': db_record_loader,
        'es': es_record_loader,
        'http': None
    }
    if source not in loaders:
        raise ValueError('source must be one of {}'.format(loaders.keys()))
    loader = loaders[source]
    return JsonRef.METHOD_NAME(obj, loader=loader, load_on_repr=False)