docs: def serialize_data(self, data, data_type, **kwargs):
          """Serialize generic data according to supplied data type.
  
          :param data: The data to be serialized.
          :param str data_type: The type to be serialized from.
          :param bool required: Whether it's essential that the data not be
           empty or None
          :raises: AttributeError if required data is None.
          :raises: ValueError if data is None
          :raises: SerializationError if serialization fails.
          """
          if data is None:
              raise ValueError("No value for given attribute")
  
          try:
              if data_type in self.basic_types.values():
                  return self.serialize_basic(data, data_type, **kwargs)
  
              elif data_type in self.serialize_type:
                  return self.serialize_type[data_type](data, **kwargs)
  
              # If dependencies is empty, try with current data class
              # It has to be a subclass of Enum anyway
              enum_type = self.dependencies.get(data_type, data.__class__)
              if issubclass(enum_type, Enum):
                  return Serializer.serialize_enum(data, enum_obj=enum_type)
  
              iter_type = data_type[0] + data_type[-1]
              if iter_type in self.serialize_type:
                  return self.serialize_type[iter_type](
                      data, data_type[1:-1], **kwargs)
  
          except (ValueError, TypeError) as err:
              msg = "Unable to serialize value: {!r} as type: {!r}."
              raise_with_traceback(
                  SerializationError, msg.format(data, data_type), err)
          else:
              return self._serialize(data, **kwargs)