def _data_to_json(data):
        """Convert to json if it isn't already a string.

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

        Args:
            data (str): data to convert to json