def METHOD_NAME(self, item):
    type_ = type(item)
    transformer = self.exact_types.get(type_)
    if transformer is not None:
        return transformer
    transformer = next(
        (
            f
            for super_type, f in self.subtypes.items()
            if isinstance(item, super_type)
        ),
        None,
    )
    if transformer is not None:
        return transformer
    return None