code: def _validate_annotation(annotation):
      """Determine if an annotation is valid for registration.
  
      An annotation is considered valid for use in registration if it is an
      instance of ``type`` and not a generic type from ``typing``.
      """
      try:
          # In Python earlier than 3.7, the classes in typing are considered
          # instances of type, but they invalid for registering single dispatch
          # functions so check against GenericMeta instead.
          from typing import GenericMeta
  
          valid = not isinstance(annotation, GenericMeta)
      except ImportError:
          # In Python 3.7+, classes in typing are not instances of type.
          valid = isinstance(annotation, type)
      return valid
  
file_path: catboost/contrib/deprecated/python/singledispatch/singledispatch/__init__.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from weakref import WeakKeyDictionary
  from .helpers import MappingProxyType, get_cache_token, get_type_hints, update_wrapper
label_desc: Use image node_id 6 for calling a global function with example usage: _validate_annotation(annotation) and returns: valid