code: def factory(start_immediately=True):
      
  
      def decorator(func):
        def wrapper(*args, **kwargs):
          job = Job(task=lambda j: func(j, *args, **kwargs))
          if start_immediately:
            job.start()
          return job
        return wrapper
      return decorator
docs: This is a decorator function that creates new `Job`s with the wrapped
      function as the target.
  
      # Example
      ```python
      @Job.factory()
      def some_longish_function(job, seconds):
        time.sleep(seconds)
        return 42
  
      job = some_longish_function(2)
      print(job.wait())
      ```
  
      # Arguments
      start_immediately (bool): #True if the factory should call #Job.start()
        immediately, #False if it should return the job in pending state.