docs: def reformat(ctx, input_fn, output_fn):
      """Reformat between JSON, YAML, JSONLines formats
  
      \b
      input_fn:
          If input fn has *.gz, will read as a gzip file
  
      \b
      output_fn:
          If output fn has *.gz, will written as a gzip file
          If output fn has *.jsonl*, will written as a JSONLines file
          IF output fn has *.json*, will be written as a JSON file
          If output fn has *.yaml* or *.yml*,  will be written as a YAML file
      """
  
      try:
  
          (
              out_fh,
              yaml_flag,
              jsonl_flag,
              json_flag,
          ) = bel.nanopub.files.create_nanopubs_fh(output_fn)
          if yaml_flag or json_flag:
              docs = []
  
          # input file
          if re.search("gz$", input_fn):
              f = gzip.open(input_fn, "rt")
          else:
              f = open(input_fn, "rt")
  
          for np in bnf.read_nanopubs(input_fn):
              if yaml_flag or json_flag:
                  docs.append(np)
              elif jsonl_flag:
                  out_fh.write("{}\n".format(json.dumps(np)))
  
          if yaml_flag:
              yaml.dump(docs, out_fh)
  
          elif json_flag:
              json.dump(docs, out_fh, indent=4)
  
      finally:
          f.close()
          out_fh.close()