code: def handle_df(fn):
      """Decorator to handle pandas Dataframe object as input
  
      If the first arg is a pandas dataframe, convert it to a numpy array
      otherwise don't do anything. Cast back to a pandas Dataframe after
      the imputation function has run
      """
  
      @wraps(fn)
      def wrapper(*args, **kwargs):
          postprocess_fn = None
          ## convert tuple to list so args can be modified
          args = list(args)
          ## Either make a copy or use a pointer to the original
          if kwargs.get("inplace"):
              args[0] = args[0]
          else:
              args[0] = args[0].copy()
  
          ## If input data is a dataframe then cast the input to an np.array
          ## and set an indicator flag before continuing
          pd_DataFrame = get_pandas_df()
          if pd_DataFrame and isinstance(args[0], pd_DataFrame):
              postprocess_fn = pd_DataFrame
              args[0] = args[0].values
  
          ## function invokation
          results = u.execute_fn_with_args_and_or_kwargs(
              fn, args, kwargs
          )
  
          ## cast the output back to a DataFrame.
          if postprocess_fn is not None:
              results = postprocess_fn(results)
  
          return results
  
      return wrapper
  
file_path: impyute/impyute/ops/wrapper.py
imports: from functools import wraps
  import numpy
  from .None import error
  from .None import matrix
  from .None import util
label_desc: Use image node_id 2 for calling a global function with example usage: handle_df(fn) and returns: wrapper, results