'Given list of resources, retrieve the quotas for given quota class.
:param context: The request context, for access checks.
:param resources: A dictionary of the registered resources.
:param quota_class: The name of the quota class to return
quotas for.
:param defaults: If True, the default value will be reported
if there is no specific value for the
resource.'

def get_class_quotas(self, context, resources, quota_class, defaults=True):

    quotas = {}
    default_quotas = {}
    class_quotas = db.quota_class_get_all_by_name(context, quota_class)
    if defaults:
        default_quotas = db.quota_class_get_defaults(context)
    for resource in resources.values():
        if (resource.name in class_quotas):
            quotas[resource.name] = class_quotas[resource.name]
            continue
        if defaults:
            quotas[resource.name] = default_quotas.get(resource.name, resource.default)
    return quotas
