code: def serialize(self, serializable: Optional[Union[SerializableType, List[SerializableType]]]) \
              -> PrimitiveJsonType:
          
          if serializable is None:
              # Implements #17
              return None
          elif isinstance(serializable, List):
              return [self.serialize(item) for item in serializable]
          else:
              serialized = self._create_serialized_container()
  
              for mapping in self._property_mappings:
                  if mapping.object_property_getter is not None and mapping.serialized_property_setter is not None:
                      value = mapping.object_property_getter(serializable)
                      if not (mapping.optional and value is None):
                          if isinstance(value, type(mapping.collection_factory([]))):
                              value = list(mapping.collection_iter(value))
                          encoded_value = self._serialize_property_value(value, mapping.serializer_cls)
                          mapping.serialized_property_setter(serialized, encoded_value)
  
              return serialized
docs: Serializes the given serializable object or collection of serializable objects.
          :param serializable: the object or objects to serialize
          :return: a serialization of the given object