code: def prep_vrn_file(in_file, vcaller, work_dir, somatic_info, writer_class, seg_file=None, params=None):
      
      data = somatic_info.tumor_data
      if not params:
          params = PARAMS
      out_file = os.path.join(work_dir, "%s-%s-prep.csv" % (utils.splitext_plus(os.path.basename(in_file))[0],
                                                            vcaller))
      if not utils.file_uptodate(out_file, in_file):
          # ready_bed = _identify_heterogeneity_blocks_seg(in_file, seg_file, params, work_dir, somatic_info)
          ready_bed = None
          if ready_bed and utils.file_exists(ready_bed):
              sub_file = _create_subset_file(in_file, ready_bed, work_dir, data)
          else:
              sub_file = in_file
          max_depth = max_normal_germline_depth(sub_file, params, somatic_info)
          with file_transaction(data, out_file) as tx_out_file:
              with open(tx_out_file, "w") as out_handle:
                  writer = writer_class(out_handle)
                  writer.write_header()
                  bcf_in = pysam.VariantFile(sub_file)
                  for rec in bcf_in:
                      stats = _is_possible_loh(rec, bcf_in, params, somatic_info, max_normal_depth=max_depth)
                      if chromhacks.is_autosomal(rec.chrom) and stats is not None:
                          writer.write_row(rec, stats)
      return out_file
docs: Select heterozygous variants in the normal sample with sufficient depth.
  
      writer_class implements write_header and write_row to write VCF outputs
      from a record and extracted tumor/normal statistics.