code: def _get_local_ref(region, ref_file, out_vcf_base):
      
      out_file = "{0}.fa".format(out_vcf_base)
      if not file_exists(out_file):
          with pysam.Fastafile(ref_file) as in_pysam:
              contig, start, end = region
              seq = in_pysam.fetch(contig, int(start), int(end))
              with open(out_file, "w") as out_handle:
                  out_handle.write(">{0}-{1}-{2}\n{3}".format(contig, start, end,
                                                                str(seq)))
      with open(out_file) as in_handle:
          in_handle.readline()
          size = len(in_handle.readline().strip())
      return out_file, size
docs: Retrieve a local FASTA file corresponding to the specified region.