'Count a resource.'

@base.remotable_classmethod
def count(cls, context, resource, *args, **kwargs):

    count = quota.QUOTAS.count_as_dict(context, resource, *args, **kwargs)
    key = ('user' if ('user' in count) else 'project')
    return count[key][resource]
