Define the serializer class for a relational field.

def _get_nested_class(self, nested_depth, relation_info):
        """ Define the serializer class for a relational field. """
        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