code: def write_jsonl_file(fname, 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())
docs: Writes a jsonl file.
  
      Args:
          data: list of json encoded data