docs: def _serialize_scalar_from_string_representation_factory(type_name, types, str_func=str):
      """Builds functions that leverage Python ``str()`` or similar functionality.
  
      Args:
          type_name (str): The name of the Ion type.
          types (Union[Sequence[type],type]): The Python types to validate for.
          str_func (Optional[Callable]): The function to convert the value with, defaults to ``str``.
  
      Returns:
          function: The function for serializing scalars of a given type to Ion text bytes.
      """
      def serialize(ion_event):
          value = ion_event.value
          validate_scalar_value(value, types)
          return six.b(str_func(value))
      serialize.__name__ = '_serialize_' + type_name
      return serialize