code: def serialize_properties(properties):
      
      new_properties = properties.copy()
      for attr_name, attr_value in new_properties.items():
          if isinstance(attr_value, datetime):
              new_properties[attr_name] = attr_value.isoformat()
          elif not isinstance(attr_value, (dict, list, tuple, str, int, float, bool, type(None))):
              # Property is not JSON-serializable according to this table
              # https://docs.python.org/3.4/library/json.html#json.JSONEncoder
              # so we convert to string
              new_properties[attr_name] = str(attr_value)
      return new_properties
docs: Serialize properties.
  
      Parameters
      ----------
      properties : dict
          Properties to serialize.