'Given a list of resources, retrieve the syncable resources
scoped to a project or a user.
A resource is syncable if it has a function to sync the quota
usage record with the actual usage of the project or user.
:param resources: A dictionary of the registered resources.
:param user_id: Optional. If user_id is specified, user-scoped
resources will be returned. Otherwise,
project-scoped resources will be returned.
:returns: A list of resource names scoped to a project or
user that can be sync\'d.'

def _get_syncable_resources(self, resources, user_id=None):

    syncable_resources = []
    per_project_resources = db.quota_get_per_project_resources()
    for (key, value) in resources.items():
        if isinstance(value, ReservableResource):
            project_scoped = ((user_id is None) and (key in per_project_resources))
            user_scoped = ((user_id is not None) and (key not in per_project_resources))
            if (project_scoped or user_scoped):
                syncable_resources.append(key)
    return syncable_resources
