code: def _get_extacted_dir(output_path: str) -> str:
      """Extracts and returns the directory containing the provided archive."""
      is_zip = zipfile.is_zipfile(output_path)
      if not (is_zip or tarfile.is_tarfile(output_path)):
          return output_path
  
      output_dir, output_file = os.path.split(output_path)
      output_extracted_dir_name = (
          output_file.replace(".", "-") + "-extracted"
      )
      output_extracted_path = os.path.join(
          output_dir, output_extracted_dir_name
      )
  
      if os.path.isdir(output_extracted_path) and os.listdir(
          output_extracted_path
      ):
          return output_extracted_path
  
      lock_path = output_path + ".lock"
      with filelock.FileLock(lock_path):
          shutil.rmtree(output_extracted_path, ignore_errors=True)
          os.makedirs(output_extracted_path)
  
          if is_zip:
              with zipfile.ZipFile(output_path, "r") as zip_file:
                  zip_file.extractall(output_extracted_path)
                  zip_file.close()
          else:
              tar_file = tarfile.open(output_path)
              tar_file.extractall(output_extracted_path)
              tar_file.close()
  
      return output_extracted_path
  
imports: from collections.abc import Mapping
  import functools
  import hashlib
  import os
  import shutil
  import sys
  import tarfile
  import tempfile
  from typing import BinaryIO, Optional
  from urllib import parse
  import zipfile
  from absl import logging
  import filelock
  import requests
  import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: _get_extacted_dir(output_path) and returns: output_extracted_path, output_path, output_extracted_path