Replace simplegeneric with singledispatch (PEP 443).

Closes-Bug: #1226813
Change-Id: I1ba149ac00353460065d4cddbe3ccd8782aaa611