code: def _validate_type(self, data_type, field, value):
          
          if not data_type:
              return
  
          types = (data_type,) if isinstance(data_type, _str_type) else data_type
  
          for _type in types:
              # TODO remove this block on next major release
              # this implementation still supports custom type validation methods
              type_definition = self.types_mapping.get(_type)
              if type_definition is not None:
                  matched = isinstance(value, type_definition.included_types) \
                      and not isinstance(value, type_definition.excluded_types)
              else:
                  type_handler = self.__get_rule_handler('validate_type', _type)
                  matched = type_handler(value)
              if matched:
                  return
  
              # TODO uncomment this block on next major release
              #      when _validate_type_* methods were deprecated:
              # type_definition = self.types_mapping[_type]
              # if isinstance(value, type_definition.included_types) \
              #         and not isinstance(value, type_definition.excluded_types):  # noqa 501
              #     return
  
          self._error(field, errors.BAD_TYPE)
          self._drop_remaining_rules()
docs: {'type': ['string', 'list'],
               'validator': 'type'}