'Returns a map of scopes to fields in that scope that should be cached'

def _fields_to_cache(self, descriptors):

    scope_map = defaultdict(set)
    for descriptor in descriptors:
        for field in descriptor.fields.values():
            scope_map[field.scope].add(field)
    return scope_map
