code: def _VerifyExtensionHandle(message, extension_handle):
      """Verify that the given extension handle is valid."""
  
      if not isinstance(extension_handle, FieldDescriptor):
          raise KeyError(
              "HasExtension() expects an extension handle, got: %s"
              % extension_handle
          )
  
      if not extension_handle.is_extension:
          raise KeyError(
              '"%s" is not an extension.' % extension_handle.full_name
          )
  
      if not extension_handle.containing_type:
          raise KeyError(
              '"%s" is missing a containing_type.'
              % extension_handle.full_name
          )
  
      if extension_handle.containing_type is not message.DESCRIPTOR:
          raise KeyError(
              'Extension "%s" extends message type "%s", but this '
              'message is of type "%s".'
              % (
                  extension_handle.full_name,
                  extension_handle.containing_type.full_name,
                  message.DESCRIPTOR.full_name,
              )
          )
  
file_path: catboost/contrib/python/protobuf/py3/google/protobuf/internal/extension_dict.py
imports: from google.protobuf.internal import type_checkers
  from google.protobuf.descriptor import FieldDescriptor
label_desc: Use image node_id 1 for calling a global function with example usage: _VerifyExtensionHandle(message, extension_handle) without return types