code: def _pack(source_dir: str) -> bytes:
      stream = io.BytesIO()
      with tarfile.open(
          fileobj=stream, mode="w:gz", format=tarfile.PAX_FORMAT
      ) as tar:
          tar.add(source_dir, arcname="")
  
      return stream.getvalue()
  
file_path: ray/release/ray_release/file_manager/remote_task.py
imports: import io
  import tarfile
  from typing import Optional
  from ray_release.file_manager.file_manager import FileManager
label_desc: Use image node_id 1 for calling a global function with example usage: _pack(source_dir) and returns: stream