code: def map_with_type(self, data: Any, type_: Type) -> Any:
      # Needs to come first as in this case type_ is an instance, not a class.
      try:
          base_type = unpack_optional(type_)
      except TypeError:
          pass
      else:
          if data is None:
              return None
          return self.map_with_type(data, base_type)
      if isclass(type_) and issubclass(type_, bool):
          return self.map_bool(data)
      if isclass(type_) and issubclass(type_, int):
          return self.map_int(data)
      if isclass(type_) and issubclass(type_, float):
          return self.map_float(data)
      if isclass(type_) and issubclass(type_, str):
          return self.map_str(data)
      if isclass(type_) and issubclass(type_, Enum):
          return self.map_enum(data, type_)
      if has_origin(type_, list):
          return self.map_list(data, type_)
      if has_origin(type_, dict):
          return self.map_dict(data, type_)
      if isclass(type_) and issubclass(type_, Schema):
          return self.map_schema(data, type_)
      raise NotImplementedError("Unknown type: %s" % type_)
  
imports: from abc import ABC, abstractmethod
  from enum import Enum
  from inspect import isclass
  from itertools import chain
  from typing import Any, ClassVar, Dict, List, Optional, Sized, Type, TypeVar, Union
  import attr
label_desc: Use image node_id 9 for calling the Mapper obj's underlying member method code with example usage: obj.map_with_type(data, type_) and returns: self, self, self, self, self, self, self, self, self, None