code: def _data_to_json(data):
          
          if type(data) not in [str, unicode]:
              data = json.dumps(data)
          return data
docs: Convert to json if it isn't already a string.
  
          Args:
              data (str): data to convert to json