code: def archive_dev_folders(
      folders: tp.List[tp.Union[str, Path]],
      outfile: tp.Optional[tp.Union[str, Path]] = None,
  ) -> Path:
      """Creates a tar.gz file with all provided folders"""
      assert isinstance(
          folders, (list, tuple)
      ), "Only lists and tuples of folders are allowed"
      if outfile is None:
          outfile = "_dev_folders_.tar.gz"
      outfile = Path(outfile)
      assert str(outfile).endswith(
          ".tar.gz"
      ), "Archive file must have extension .tar.gz"
      with tarfile.TarFile(outfile, mode="w") as tf:
          for folder in folders:
              tf.add(str(folder), arcname=Path(folder).name)
      return outfile
  
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 3 for calling a global function with example usage: archive_dev_folders(folders, outfile) and returns: outfile