code: def json_serial(obj):
      
      if isinstance(obj, datetime):
          serial = obj.isoformat()
          return serial
      raise TypeError("Type not serializable")
docs: JSON serializer for objects not serializable by default json code