code: def _assert_key_exists_in_custom_metadata(
      key: str, dictionary: Dict[str, Any]
  ):
      """Raises a formatted KeyError if key is not a key of the dictionary."""
      if key not in dictionary.keys():
          raise KeyError(
              f"Key {key} not found in custom metadata.\n"
              f"Found keys: {dictionary.keys()}"
          )
  
file_path: lightly/lightly/api/api_workflow_upload_metadata.py
imports: from concurrent.futures import ThreadPoolExecutor
  from typing import Any, Dict, List, Union
  from requests import Response
  from tqdm import tqdm
  from lightly.api.utils import paginate_endpoint, retry
  from lightly.openapi_generated.swagger_client.models import ConfigurationEntry, ConfigurationSetRequest, SampleDataModes, SamplePartialMode, SampleUpdateRequest
  from lightly.utils import hipify
  from lightly.utils.io import COCO_ANNOTATION_KEYS
label_desc: Use image node_id 1 for calling a global function with example usage: _assert_key_exists_in_custom_metadata(key, dictionary) without return types