code: def maybe_resolve_conflicting_variants(sorted_variants):
      """Yields Variant protos in sorted order after fixing conflicting haplotypes.
  
      The input is an iterable of Variants in chromosome and position sorted order,
      with potential incompatibilies as described in this module's docstring. This
      function tries to resolve variants into valid haplotypes, though is not
      guaranteed to do so if the variant composition is not amenable to this or it
      would be computationally intractable.
  
      Args:
        sorted_variants: Iterable of Variant protos. Sorted in coordinate order, but
          with potentially incompatible haplotypes.
  
      Yields:
        Variant protos in coordinate-sorted order with no incompatible haplotypes.
      """
      if FLAGS.disable_haplotype_resolution:
          logging.info(
              "disable_haplotype_resolution is True. "
              "`maybe_resolve_conflicting_variants` has no effect."
          )
          for v in sorted_variants:
              yield v
      else:
          for overlapping_candidates in _group_overlapping_variants(
              sorted_variants
          ):
              for resolved_candidate in _maybe_resolve_mixed_calls(
                  overlapping_candidates
              ):
                  yield resolved_candidate
  
imports: import copy
  import itertools
  from absl import flags
  from absl import logging
  import numpy
  from third_party.nucleus.util import genomics_math
  from third_party.nucleus.util import variant_utils
label_desc: Use image node_id 1 for calling a global function with example usage: maybe_resolve_conflicting_variants(sorted_variants) without return types