Refactor overload resolution so can have methods multiple times

The overload resolution algorithm allows one to have methods multiple times.
Thus we can't associate a test with one method:
we need to produce a list [(test, method)], since a given method may
be listed repeatedly.

This moves the overall list production into Python, as it's very complex;
the template code is now very simple.
(Changed "no test" to |if (true)| to simplify the template.)

Also refactors Python code so much flatter and less nested.

R=haraken
BUG=293561

Review URL: https://codereview.chromium.org/278223005

git-svn-id: svn://svn.chromium.org/blink/trunk@173930 bbb929c8-8fbe-4397-9dbb-9b2b20218538