def write_jsonl_file(fname, data):
    """Writes a jsonl file.

    Args:
        data: list of json encoded data
    """
    if not isinstance(data, list):
        print('warning: malformed json data for file', fname)
        return
    with open(fname, 'w') as of:
        for row in data:
            # TODO: other malformed cases?
            if row.strip():
                of.write('%s\n' % row.strip())
Writes a jsonl file.

    Args:
        data: list of json encoded data