def METHOD_NAME(self, expr, *args, **kwargs):
    mro = list(type(expr).__mro__)
    dispatch_class = kwargs.pop("dispatch_class", type(self))
    while mro:
        method_name = "map_"+mro.pop(0).__name__
        try:
            method = getattr(dispatch_class, method_name)
        except AttributeError:
            pass
        else:
            return method(self, expr, *args, **kwargs)
    raise NotImplementedError(
            "%s does not know how to map type '%s'"
            % (type(self).__name__,
                type(expr)))