docs: def enostask(new=False):
      """Decorator for an Enos Task.
  
      This decorator lets you define a new Enos task and helps you manage the
      environment. It injects the environment in the function called.
  
      Args:
          new (bool): indicates if a new environment must be created.
              Usually this is set on the first task of the workflow.
  
      Examples:
  
          .. code-block:: python
  
              @enostask(new=True)
              def foo(env=None, **kwargs):
                  # The key resultdir is available once the env is created
                  print(env["resultdir"])
  
              @enostask()
              def myfunction(env=None, **kwargs):
                  # saving a new key
                  env['foo'] = 'bar'
      """
      def decorator(fn):
          @wraps(fn)
          def decorated(*args, **kwargs):
              # Constructs the environment
              # --env or env are reserved keyword to reuse existing env
              k_env = kwargs.get("--env") or kwargs.get("env")
              if new:
                  kwargs["env"] = _make_env(k_env)
                  kwargs["env"]["resultdir"] = _set_resultdir(k_env)
                  # the previous SYMLINK to the created result_dir
              else:
                  kwargs["env"] = _make_env(k_env or SYMLINK_NAME)
              try:
                  # Proceeds with the function execution
                  logger.info("- Task %s started -" % fn.__name__)
                  r = fn(*args, **kwargs)
                  logger.info("- Task %s finished -" % fn.__name__)
                  return r
              # Save the environment
              finally:
                  _save_env(kwargs["env"])
          return decorated
      return decorator