Fix a compile error when some overloads marked LEGACY.

In the situation where one overload was marked legacy while others
weren't, and the legacy overload took a different number of arguments
than the other overloads, a compile error would occur in the python
wrappers.  This patch fixes the issue, but it also adds yet another
loop over all wrapped methods.  Eventually a better data structure
should be added to make wrapping of overloaded methods less messy.

Change-Id: I0b527532c21960052d0583cd37508d0417d9cbf6
Merge topic 'wrap-legacy-overload' into master

99a6adb3 Fix a compile error when some overloads marked LEGACY.