docs: def get_multiplier(weights, root_generic_multiplier):
      """
      Determine tradeable instrument multiplier based on generic asset
      multipliers and weights mapping from generics to tradeables.
  
      Parameters
      ----------
      weights: pandas.DataFrame or dict
          A pandas.DataFrame of loadings of generic contracts on tradeable
          instruments **for a given date**. The columns are integers refering to
          generic number indexed from 0, e.g. [0, 1], and the index is strings
          representing instrument names. If dict is given keys should be generic
          instrument names, e.g. 'CL', and values should be pandas.DataFrames of
          loadings. The union of all indexes should be a superset of the
          instruments.index
      root_generic_multiplier: pandas.Series
          Series of multipliers for generic instruments lexigraphically sorted.
          If a dictionary of weights is given, root_generic_multiplier.index
          should correspond to the weights keys.
  
      Returns
      -------
      A pandas.Series of multipliers for tradeable instruments.
  
      Examples
      --------
      >>> import pandas as pd
      >>> import mapping.util as util
      >>> wts = pd.DataFrame([[0.5, 0], [0.5, 0.5], [0, 0.5]],
      ...                    index=["CLX16", "CLZ16", "CLF17"],
      ...                    columns=[0, 1])
      >>> ast_mult = pd.Series([1000], index=["CL"])
      >>> util.get_multiplier(wts, ast_mult)
      """
      if len(root_generic_multiplier) > 1 and not isinstance(weights, dict):
          raise ValueError("For multiple generic instruments weights must be a "
                           "dictionary")
  
      mults = []
      intrs = []
      for ast, multiplier in root_generic_multiplier.iteritems():
          if isinstance(weights, dict):
              weights_ast = weights[ast].index
          else:
              weights_ast = weights.index
          mults.extend(np.repeat(multiplier, len(weights_ast)))
          intrs.extend(weights_ast)
  
      imults = pd.Series(mults, intrs)
      imults = imults.sort_index()
      return imults