code: def _vaf_histograms_by_genotype(single_stats, number_of_bins=10):
      """Computes histograms of allele frequency for each genotype.
  
      Args:
        single_stats: list of VariantStats objects.
        number_of_bins: integer, number of bins in allele frequency histogram.
  
      Returns:
        A dictionary keyed by genotype where each value is a list of bins.
      """
  
      # Group by genotype
      sorted_by_genotype = sorted(
          single_stats, key=lambda x: x.genotype
      )
      grouped_by_genotype = itertools.groupby(
          sorted_by_genotype, lambda x: x.genotype
      )
      # Fill in empty placeholders for genotypes to populate all five charts
      stats_by_genotype = {}
      required_genotypes = [
          "[0, 0]",
          "[0, 1]",
          "[1, 1]",
          "[-1, -1]",
          "[1, 2]",
      ]
      for genotype in required_genotypes:
          # Create a few placeholder bins
          stats_by_genotype[genotype] = _fraction_histogram([], 2)
      # Count vafs from variants (replacing placeholders)
      for genotype, group in grouped_by_genotype:
          # Get VAF for each variant where it is defined
          vafs = [x.vaf for x in group if x.vaf is not None]
          stats_by_genotype[genotype] = _fraction_histogram(
              vafs, number_of_bins
          )
  
      return stats_by_genotype
  
imports: import collections
  import itertools
  import math
  import numpy
  from third_party.nucleus.util import variant_utils
  from third_party.nucleus.util import variantcall_utils
  from deepvariant import vcf_stats_vis
label_desc: Use image node_id 8 for calling a global function with example usage: _vaf_histograms_by_genotype(single_stats, number_of_bins) and returns: stats_by_genotype