code: def generate_gap_bed(fname, outname):
       
      f = Fasta(fname)
      with open(outname, "w") as bed:
          for chrom in f.keys():
              for m in re.finditer(r'N+', f[chrom][:].seq):
                  bed.write("{}\t{}\t{}\n".format(chrom, m.start(0), m.end(0)))
docs: Generate a BED file with gap locations.
  
      Parameters
      ----------
      fname : str
          Filename of input FASTA file.
  
      outname : str
          Filename of output BED file.