code: def ensure_mkdir_p(mode=0o777):
      
  
      def decorator(f):
          @functools.wraps(f)
          def decorated(*args, **kwargs):
              path = f(*args, **kwargs)
              mkdir_p(path, mode=mode)
              return path
  
          return decorated
  
      return decorator
docs: Decorator to ensure `mkdir_p` is called to the function's return value.