code: def vectorize(func):
      """
      Decorator so that functions can be written to work on Series but
      may still be called with DataFrames.
      """
  
      def wrapper(df, *args, **kwargs):
          if df.ndim == 1:
              return func(df, *args, **kwargs)
          elif df.ndim == 2:
              return df.apply(func, *args, **kwargs)
  
      return wrapper
  
imports: from __future__ import division
  import warnings
  from itertools import cycle
  from matplotlib.pyplot import cm
  import numpy
  import pandas
  from IPython.display import display, HTML
  import empyrical.utils
  from .None import pos
  from .None import txn
label_desc: Use image node_id 5 for calling a global function with example usage: vectorize(func) and returns: wrapper, func, df