code: def get_top_level_dir_from_compressed_package(package_path: str):
      """
      If compressed package at package_path contains a single top-level
      directory, returns the name of the top-level directory. Otherwise,
      returns None.
  
      Ignores a second top-level directory if it is named __MACOSX.
      """
  
      package_zip = ZipFile(package_path, "r")
      top_level_directory = None
  
      def is_top_level_file(file_name):
          return "/" not in file_name
  
      def base_dir_name(file_name):
          return file_name.split("/")[0]
  
      for file_name in package_zip.namelist():
          if top_level_directory is None:
              # Cache the top_level_directory name when checking
              # the first file in the zipped package
              if is_top_level_file(file_name):
                  return None
              else:
                  # Top-level directory, or non-top-level file or directory
                  dir_name = base_dir_name(file_name)
                  if dir_name == MAC_OS_ZIP_HIDDEN_DIR_NAME:
                      continue
                  top_level_directory = dir_name
          else:
              # Confirm that all other files
              # belong to the same top_level_directory
              if is_top_level_file(file_name) or base_dir_name(
                  file_name
              ) not in [
                  top_level_directory,
                  MAC_OS_ZIP_HIDDEN_DIR_NAME,
              ]:
                  return None
  
      return top_level_directory
  
imports: import asyncio
  import hashlib
  import logging
  import os
  import shutil
  from enum import Enum
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import Callable, List, Optional, Tuple
  from urllib.parse import urlparse
  from zipfile import ZipFile
  from filelock import FileLock
  from ray.util.annotations import DeveloperAPI
  from ray._private.ray_constants import RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_DEFAULT, RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_ENV_VAR, RAY_RUNTIME_ENV_IGNORE_GITIGNORE
  from ray._private.runtime_env.conda_utils import exec_cmd_stream_to_logger
  from ray._private.thirdparty.pathspec import PathSpec
  from ray.experimental.internal_kv import _internal_kv_exists, _internal_kv_put, _pin_runtime_env_uri
label_desc: Use image node_id 22 for calling a global function with example usage: get_top_level_dir_from_compressed_package(package_path) and returns: top_level_directory, unknown, file_name, None, None