code: def normal_power(
      effect_size, nobs, alpha, alternative="two-sided", sigma=1.0
  ):
      """Calculate power of a normal distributed test statistic
  
      This is an generalization of `normal_power` when variance under Null and
      Alternative differ.
  
      Parameters
      ----------
      effect size : float
          difference in the estimated means or statistics under the alternative
          normalized by the standard deviation (without division by sqrt(nobs).
      nobs : float or int
          number of observations
      alpha : float in interval (0,1)
          significance level, e.g. 0.05, is the probability of a type I
          error, that is wrong rejections if the Null Hypothesis is true.
      alternative : string, 'two-sided' (default), 'larger', 'smaller'
          extra argument to choose whether the power is calculated for a
          two-sided (default) or one sided test. The one-sided test can be
          either 'larger', 'smaller'.
      """
  
      d = effect_size
  
      if alternative in ["two-sided", "2s"]:
          alpha_ = alpha / 2.0  # no inplace changes, does not work
      elif alternative in ["smaller", "larger"]:
          alpha_ = alpha
      else:
          raise ValueError(
              "alternative has to be 'two-sided', 'larger' "
              + "or 'smaller'"
          )
  
      pow_ = 0
      if alternative in ["two-sided", "2s", "larger"]:
          crit = stats.norm.isf(alpha_)
          pow_ = stats.norm.sf(crit - d * np.sqrt(nobs) / sigma)
      if alternative in ["two-sided", "2s", "smaller"]:
          crit = stats.norm.ppf(alpha_)
          pow_ += stats.norm.cdf(crit - d * np.sqrt(nobs) / sigma)
      return pow_
  
imports: import warnings
  import numpy
  from scipy import stats, optimize, special
  from statsmodels.tools.rootfinding import brentq_expanding
label_desc: Use image node_id 7 for calling a global function with example usage: normal_power(effect_size, nobs, alpha, alternative, sigma) and returns: pow_