Fix oauth2client.tools.

The last commit used a function before it was defined; code blew up on import.

This fixes the issue and adds a test.