code: def __init__(self, attr_type, *args, **kwargs):
      super().__init__(*args, **kwargs)
      self.attr_type = attr_type
      try:
          origin = attr_type.__origin__
          subtypes = attr_type.__args__
      except AttributeError:  # normal types
          self.attr_type = (attr_type,)
      else:
          if origin is Union:
              self.attr_type = subtypes
          else:
              raise TypeError(
                  f"{attr_type} is not currently supported."
              )
  
imports: from abc import ABC, abstractmethod
  from typing import TypeVar, Union
label_desc: Use image node_id 1 to create a new TypeValidator object from inherited base classes: Validator with example: obj = TypeValidator(attr_type)