code: def _get_genotypes_col(
      entry: StructExpression, sample_ids: Optional[List[str]]
  ) -> Column:
      assert check_argument_types()
  
      entry_aliases = {
          "DP": "depth",
          "FT": "filters",
          "GL": "genotypeLikelihoods",
          "PL": "phredLikelihoods",
          "GP": "posteriorProbabilities",
          "GQ": "conditionalQuality",
          "HQ": "haplotypeQualities",
          "EC": "expectedAlleleCounts",
          "MQ": "mappingQuality",
          "AD": "alleleDepths",
      }
  
      base_struct_args = []
      for entry_field in entry:
          if entry_field == "GT" and entry.GT.dtype == tcall:
              # Flatten GT into calls and phased
              base_struct_args.append(
                  "'calls', ifnull(e.GT.alleles, array(-1,-1)), 'phased', e.GT.phased"
              )
          elif entry[entry_field].dtype == tcall:
              # Turn other call fields (eg. PGT) into a string
              base_struct_args.append(
                  f"'{entry_field}', array_join(e.{entry_field}.alleles, if(e.{entry_field}.phased, '|', '/'))"
              )
          elif entry_field in entry_aliases:
              # Rename aliased genotype fields
              base_struct_args.append(
                  f"'{entry_aliases[entry_field]}', e.{entry_field}"
              )
          else:
              # Rename genotype fields
              base_struct_args.append(
                  f"'{entry_field}', e.{entry_field}"
              )
  
      if sample_ids is not None:
          sample_id_expr = f"array({' ,'.join(sample_ids)})"
          struct_expr = " ,".join(["'sampleId', s"] + base_struct_args)
          genotypes_col = fx.expr(
              f"zip_with({sample_id_expr}, entries, (s, e) -> named_struct({struct_expr}))"
          )
      else:
          struct_expr = " ,".join(base_struct_args)
          genotypes_col = fx.expr(
              f"transform(entries, e -> named_struct({struct_expr}))"
          )
      genotypes_col = genotypes_col.alias("genotypes")
  
      assert check_return_type(genotypes_col)
      return genotypes_col
  
file_path: glow/python/glow/hail/functions.py
imports: import hail
  from hail import MatrixTable
  from hail.expr.expressions.typed_expressions import StructExpression
  from hail.expr.types import tarray, tbool, tcall, tfloat64, tint, tlocus, tset, tstr, tstruct
  from pyspark.sql import Column, DataFrame
  import pyspark.sql.functions
  from typing import List, NoReturn, Optional
  from typeguard import check_argument_types, check_return_type
label_desc: Use image node_id 2 for calling a global function with example usage: _get_genotypes_col(entry, sample_ids) and returns: genotypes_col