code: def get_loci_fasta(loci, out_fa, ref):
      
      if not find_cmd("bedtools"):
          raise ValueError("Not bedtools installed")
      with make_temp_directory() as temp:
          bed_file = os.path.join(temp, "file.bed")
          for nc, loci in loci.iteritems():
              for l in loci:
                  with open(bed_file, 'w') as bed_handle:
                      logger.debug("get_fasta: loci %s" % l)
                      nc, c, s, e, st = l
                      print("{0}\t{1}\t{2}\t{3}\t{3}\t{4}".format(c, s, e, nc, st), file=bed_handle)
                  get_fasta(bed_file, ref, out_fa)
      return out_fa
docs: get fasta from precursor