def _add_internal_prefetches(
        self,
        prefetches,
        requirements
    ):
        paths = requirements.get_paths()
        for path in paths:
            # Remove last segment, which indicates a field name or wildcard.
            # For example, {model_a : {model_b : {field_c}}
            # should be prefetched as a__b
            prefetch_path = path[:-1]
            key = '__'.join(prefetch_path)
            if key:
                prefetches[key] = key
                if self.DEBUG:
                    self._prefetches[key] = {}
Add internal (required) prefetches to a prefetch dictionary.
dataset/ETHPy150Open AltSchool/dynamic-rest/dynamic_rest/filters.py/DynamicFilterBackend._add_internal_prefetches