class_docstr: Wraps a command as a function in order to make sure it goes through the
  pipeline and notify when it is finished.
  The output is a string containing everything that has been sent to stdout.
  WARNING: use CommandFunction only if you know the output won't be too big !
  Otherwise use subprocess.run() that also streams the outputto stdout/stderr.
  
  Parameters
  ----------
  command: list
      command to run, as a list
  verbose: bool
      prints the command and stdout at runtime
  cwd: Path/str
      path to the location where the command must run from
  
  Returns
  -------
  str
     Everything that has been sent to stdout
class_docstr_tok: ["Wraps","a","command","as","a","function","in","order","to","make","sure","it","goes","through","the","pipeline","and","notify","when","it","is","finished",".","The","output","is","a","string","containing","everything","that","has","been","sent","to","stdout",".","WARNING",":","use","CommandFunction","only","if","you","know","the","output","wo","n't","be","too","big","!","Otherwise","use","subprocess.run","(",")","that","also","streams","the","outputto","stdout\/stderr",".","Parameters","--","--","--","--","--","command",":","list","command","to","run",",","as","a","list","verbose",":","bool","prints","the","command","and","stdout","at","runtime","cwd",":","Path\/str","path","to","the","location","where","the","command","must","run","from","Returns","--","--","--","-","str","Everything","that","has","been","sent","to","stdout"]
code: def __init__(
      self,
      command: tp.List[str],
      verbose: bool = True,
      cwd: tp.Optional[tp.Union[str, Path]] = None,
      env: tp.Optional[tp.Dict[str, str]] = None,
  ) -> None:
      if not isinstance(command, list):
          raise TypeError("The command must be provided as a list")
      self.command = command
      self.verbose = verbose
      self.cwd = None if cwd is None else str(cwd)
      self.env = env
  
imports: import contextlib
  import io
  import itertools
  import os
  import pickle
  import select
  import shutil
  import subprocess
  import sys
  import tarfile
  import typing
  from pathlib import Path
  import cloudpickle
label_desc: Use image node_id 1 to create a new CommandFunction object  with example: obj = CommandFunction(command, verbose, cwd, env)