code: def sanity_check_fasta(handle):
      
      header_found = False
      for line in handle:
          if line.startswith('>'):
              header_found = True
              break
  
      handle.seek(0)
  
      if header_found:
          return handle
  
      fake_header_line = ">DUMMY"
      new_handle = StringIO()
      new_handle.write("%s\n" % fake_header_line)
      new_handle.write(handle.read())
      new_handle.seek(0)
      return new_handle
docs: Sanity check FASTA files.