code: def validate_serializer(serializer, _type):
      
      if not issubclass(serializer, _type):
          raise ValueError("Serializer should be an instance of {}".format(_type.__name__))
docs: Validates the serializer for given type.
  
      :param serializer: (Serializer), the serializer to be validated.
      :param _type: (Type), type to be used for serializer validation.