'A helper method which retrieves the quotas for the specific
resources identified by keys, and which apply to the current
context.
:param context: The request context, for access checks.
:param resources: A dictionary of the registered resources.
:param keys: A list of the desired quotas to retrieve.
:param project_id: Specify the project_id if current context
is admin and admin wants to impact on
common user\'s tenant.
:param user_id: Specify the user_id if current context
is admin and admin wants to impact on
common user.
:param project_quotas: Quotas dictionary for the specified project.'

def _get_quotas(self, context, resources, keys, project_id=None, user_id=None, project_quotas=None):

    desired = set(keys)
    sub_resources = {k: v for (k, v) in resources.items() if (k in desired)}
    if (len(keys) != len(sub_resources)):
        unknown = (desired - set(sub_resources.keys()))
        raise exception.QuotaResourceUnknown(unknown=sorted(unknown))
    if user_id:
        LOG.debug('Getting    quotas    for    user    %(user_id)s    and    project    %(project_id)s.    Resources:    %(keys)s', {'user_id': user_id, 'project_id': project_id, 'keys': keys})
        quotas = self.get_user_quotas(context, sub_resources, project_id, user_id, context.quota_class, usages=False, project_quotas=project_quotas)
    else:
        LOG.debug('Getting    quotas    for    project    %(project_id)s.    Resources:    %(keys)s', {'project_id': project_id, 'keys': keys})
        quotas = self.get_project_quotas(context, sub_resources, project_id, context.quota_class, usages=False, project_quotas=project_quotas)
    return {k: v['limit'] for (k, v) in quotas.items()}
