'A helper method which retrieves the quotas for specific resources.
This specific resource is 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 has_sync: If True, indicates that the resource must
have a sync attribute; if False, indicates
that the resource must NOT have a sync
attribute.
:param project_id: Specify the project_id if current context
is admin and admin wants to impact on
common user\'s tenant.'

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

    if has_sync:
        sync_filt = (lambda x: hasattr(x, 'sync'))
    else:
        sync_filt = (lambda x: (not hasattr(x, 'sync')))
    desired = set(keys)
    sub_resources = {k: v for (k, v) in resources.items() if ((k in desired) and sync_filt(v))}
    if (len(keys) != len(sub_resources)):
        unknown = (desired - set(sub_resources.keys()))
        raise exception.QuotaResourceUnknown(unknown=sorted(unknown))
    quotas = self.get_project_quotas(context, sub_resources, project_id, context.quota_class, usages=False)
    return {k: v['limit'] for (k, v) in quotas.items()}
