code: def to_json(data, pretty):
      
      if pretty:
          return json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))
      return json.dumps(data)
docs: Converts object to JSON formatted string with typeToken adapter
      :param data: A dictionary to convert to JSON string
      :param pretty: A boolean deciding whether or not to pretty format the JSON string
      :return: The JSON string