code: def extend_haplotypes(prefix_haplotypes_list, haplotypes):
      """Yields all diploid combinations of prefix_haplotypes_list x haplotypes.
  
      Args:
        prefix_haplotypes_list: list[set[string]]: prefix_haplotypes_list contains a
          list of set[string], which are just like haplotypes (i.e., contains 1 or 2
          strings), that collectively represent all possible prefixes of haplotypes.
        haplotypes: set[string]. A set containing 1 or 2 haplotype strings. So it
          looks like {h} or {h1, h2}.
  
      Yields:
        A series of set[string], each containing 1 or 2 haplotype strings.
  
      Raises:
        ValueError: if any of the arguments are invalid.
      """
      if not prefix_haplotypes_list:
          raise ValueError("prefix_haplotypes_list cannot be empty")
      if len(haplotypes) not in {1, 2}:
          raise ValueError(
              "haplotypes must have exactly 1 or 2 elements", haplotypes
          )
  
      for prefix_haplotypes in prefix_haplotypes_list:
          if len(prefix_haplotypes) == 1:
              (f,) = prefix_haplotypes
              yield {f + h for h in haplotypes}
          else:
              f1, f2 = prefix_haplotypes
              if len(haplotypes) == 1:
                  (h,) = haplotypes
                  yield {f1 + h, f2 + h}
              else:
                  h1, h2 = haplotypes
                  yield {f1 + h1, f2 + h2}
                  yield {f1 + h2, f2 + h1}
  
imports: import collections
  import copy
  import enum
  import heapq
  import itertools
  from absl import logging
  from deepvariant.labeler import variant_labeler
  from deepvariant.protos import deepvariant_pb2
  from third_party.nucleus.io import fasta
  from third_party.nucleus.util import ranges
  from third_party.nucleus.util import variant_utils
  from third_party.nucleus.util import variantcall_utils
label_desc: Use image node_id 8 for calling a global function with example usage: extend_haplotypes(prefix_haplotypes_list, haplotypes) without return types