code: def vectorize(func):
      
  
      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
docs: Decorator so that functions can be written to work on Series but
      may still be called with DataFrames.