'Count a resource.
For countable resources, invokes the count() function and
returns its result.  Arguments following the context and
resource are passed directly to the count function declared by
the resource.
:param context: The request context, for access checks.
:param resource: The name of the resource, as a string.'

def count(self, context, resource, *args, **kwargs):

    res = self.resources.get(resource)
    if ((not res) or (not hasattr(res, 'count'))):
        raise exception.QuotaResourceUnknown(unknown=[resource])
    return res.count(context, *args, **kwargs)
