code: def make_betas(mt, h2, pi=None, annot=None, rg=None):
      r"""Generates betas under different models.
  
      Simulates betas (SNP effects) under the infinitesimal, spike & slab, or
      annotation-informed models, depending on parameters passed.
  
      Parameters
      ----------
      mt : :class:`.MatrixTable`
          MatrixTable containing genotypes to be used. Also should contain
          variant annotations as row fields if running the annotation-informed
          model or covariates as column fields if adding population stratification.
      h2 : :obj:`float` or :obj:`int` or :obj:`list` or :class:`numpy.ndarray`
          SNP-based heritability of simulated trait(s).
      pi : :obj:`float` or :obj:`int` or :obj:`list` or :class:`numpy.ndarray`, optional
          Probability of SNP being causal when simulating under the spike & slab
          model. If doing two-trait spike & slab `pi` is a list of probabilities for
          overlapping causal SNPs (see docstring of :func:`.multitrait_ss`)
      annot : :class:`.Expression`, optional
          Row field of aggregated annotations for annotation-informed model.
      rg : :obj:`float` or :obj:`int` or :obj:`list` or :class:`numpy.ndarray`, optional
          Genetic correlation between traits.
  
      Returns
      -------
      mt : :class:`.MatrixTable`
          :class:`.MatrixTable` with betas as a row field, simulated according to specified model.
      pi : :obj:`list`
          Probability of a SNP being causal for different traits, possibly altered
          from input `pi` if covariance matrix for multitrait simulation was not
          positive semi-definite.
      rg : :obj:`list`
          Genetic correlation between traits, possibly altered from input `rg` if
          covariance matrix for multitrait simulation was not positive semi-definite.
  
      """
      h2 = (
          h2.tolist()
          if isinstance(h2, np.ndarray)
          else ([h2] if not isinstance(h2, list) else h2)
      )
      pi = (
          pi.tolist()
          if isinstance(pi, np.ndarray)
          else ([pi] if not isinstance(pi, list) else pi)
      )
      rg = (
          rg.tolist()
          if isinstance(rg, np.ndarray)
          else ([rg] if not isinstance(rg, list) else rg)
      )
      assert all(
          x >= 0 and x <= 1 for x in h2
      ), "h2 values must be between 0 and 1"
      assert (pi is not [None]) or all(
          x >= 0 and x <= 1 for x in pi
      ), "pi values for spike & slab must be between 0 and 1"
      assert rg == [None] or all(
          x >= -1 and x <= 1 for x in rg
      ), "rg values must be between -1 and 1 or None"
      if annot is not None:  # multi-trait annotation-informed
          assert rg == [
              None
          ], "Correlated traits not supported for annotation-informed model"
          h2 = h2 if isinstance(h2, list) else [h2]
          annot_sum = mt.aggregate_rows(hl.agg.sum(annot))
          mt = mt.annotate_rows(
              beta=hl.literal(h2).map(
                  lambda x: hl.rand_norm(
                      0, hl.sqrt(annot * x / (annot_sum * M))
                  )
              )
          )
      elif len(h2) > 1 and (
          pi == [None] or pi == [1]
      ):  # multi-trait correlated infinitesimal
          mt, rg = multitrait_inf(mt=mt, h2=h2, rg=rg)
      elif (
          len(h2) == 2 and len(pi) > 1 and len(rg) == 1
      ):  # two trait correlated spike & slab
          print("multitrait ss")
          mt, pi, rg = multitrait_ss(
              mt=mt, h2=h2, rg=0 if rg is [None] else rg[0], pi=pi
          )
      elif (
          len(h2) == 1 and len(pi) == 1
      ):  # single trait infinitesimal/spike & slab
          M = mt.count_rows()
          pi_temp = 1 if pi == [None] else pi[0]
          mt = mt.annotate_rows(
              beta=hl.rand_bool(pi_temp)
              * hl.rand_norm(0, hl.sqrt(h2[0] / (M * pi_temp)))
          )
      else:
          raise ValueError("Parameters passed do not match any models.")
      return mt, pi, rg
  
imports: import hail
  from hail.typecheck import typecheck, oneof, nullable
  from hail.expr.expressions import expr_float64, expr_int32, expr_array, expr_call
  from hail.matrixtable import MatrixTable
  from hail.table import Table
  from hail.utils.java import Env
  import numpy
  import pandas
  import scipy.stats
label_desc: Use image node_id 2 for calling a global function with example usage: make_betas(mt, h2, pi, annot, rg) and returns: mt,  pi,  rg