def __call__(self, *args, **kwargs):
dispatch_type = self.dispatch_function(args, kwargs)<EOL>implementation = self._find_and_cache_best_function(dispatch_type)<EOL>if implementation:<EOL><INDENT>return implementation(*args, **kwargs)<EOL><DEDENT>try:<EOL><INDENT>return self.func(*args, **kwargs)<EOL><DEDENT>except NotImplementedError:<EOL><INDENT>if isinstance(None, dispatch_type):<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % self.func_name)<EOL><DEDENT>implemented_types = [t for t, _ in self.implementations]<EOL>raise NotImplementedError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (self.func_name, dispatch_type, implemented_types))<EOL><DEDENT>
Pick the appropriate overload based on args and call it.