<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compress_json(data):
 """ Take a Python data object. Convert to JSON and compress using lzstring """

    json_string = json.dumps(data).encode('utf-8', 'ignore').decode('utf-8')
    # JSON.parse() doesn't handle `NaN`, but it does handle `null`.
    json_string = json_string.replace('NaN', 'null');
    x = lzstring.LZString()
    return x.compressToBase64(json_string)