code: def _get_nested_class(self, nested_depth, relation_info):
          
          class NestedModelPermissionSerializer(ModelPermissionsSerializer):
  
              """ Default nested class for relation. """
  
              class Meta:
                  model = relation_info.related_model
                  depth = nested_depth - 1
                  nested_context = self.context
                  fields = '__all__'
  
          return NestedModelPermissionSerializer
docs: Define the serializer class for a relational field.