code: def update_haplotype(variant, reference_haplotype, reference_offset):
      """Updates haplotypes for a variant.
  
      A list of variant haplotypes are updated given a variant and a reference
      haplotype (this consists of a sequence and an offset wrt to the reference).
      All ALT alleles are updated as independent updated haplotypes.
  
      Args:
        variant: A Variant proto.
        reference_haplotype: A string extracted from the reference genome.
        reference_offset: An integer. The offset of the starting position of
          reference_haplotype on reference.
  
      Raises:
        ValueError: Variant.start is smaller than reference_offset.
  
      Returns:
        A list of haplotype objects. Haplotype objects are stored as dicts:
          {'haplotype': a haplotype (string),
           'alt': an alt allele (string),
           'variant': a Variant proto}
      """
      if variant.start < reference_offset:
          raise ValueError(
              "The starting position of a variant is smaller than its ",
              "corresponding reference offset",
              variant.start,
              reference_offset,
          )
      offset_start = variant.start - reference_offset
      offset_suffix = (
          variant.start
          + len(variant.reference_bases)
          - reference_offset
      )
      list_updated_haplotype = []
      for biallelic_variant in variant.alternate_bases:
          updated_haplotype = (
              reference_haplotype[:offset_start]
              + biallelic_variant
              + reference_haplotype[offset_suffix:]
          )
          dict_haplotype = {
              "haplotype": updated_haplotype,
              "alt": biallelic_variant,
              "variant": variant,
          }
          list_updated_haplotype.append(dict_haplotype)
  
      return list_updated_haplotype
  
file_path: deepvariant/deepvariant/allele_frequency.py
imports: import collections
  from typing import DefaultDict, Sequence, Optional
  from absl import logging
  from third_party.nucleus.io import vcf
  from third_party.nucleus.util import ranges
  from third_party.nucleus.util import variant_utils
  from deepvariant.protos import deepvariant_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: update_haplotype(variant, reference_haplotype, reference_offset) and returns: list_updated_haplotype