code: def annualization_factor(period, annualization):
      """
      Return annualization factor from period entered or if a custom
      value is passed in.
  
      Parameters
      ----------
      period : str, optional
          Defines the periodicity of the 'returns' data for purposes of
          annualizing. Value ignored if `annualization` parameter is specified.
          Defaults are:
              'monthly':12
              'weekly': 52
              'daily': 252
      annualization : int, optional
          Used to suppress default values available in `period` to convert
          returns into annual returns. Value should be the annual frequency of
          `returns`.
  
      Returns
      -------
      float
          Annualization factor.
      """
      if annualization is None:
          try:
              factor = ANNUALIZATION_FACTORS[period]
          except KeyError:
              raise ValueError(
                  "Period cannot be '{}'. "
                  "Can be '{}'.".format(
                      period, "', '".join(ANNUALIZATION_FACTORS.keys())
                  )
              )
      else:
          factor = annualization
      return factor
  
imports: from __future__ import division
  from functools import wraps
  import pandas
  import numpy
  from scipy import stats
  from six import iteritems
  from empyrical.utils import nanmean, nanstd, nanmin
label_desc: Use image node_id 2 for calling a global function with example usage: annualization_factor(period, annualization) and returns: factor