code: def rec_apply(func, n):
      
      if n > 1:
          rec_func = rec_apply(func, n - 1)
          return lambda x: func(rec_func(x))
      return func
docs: Used to determine parent directory n levels up
      by repeatedly applying os.path.dirname