Ported to Python 3 (backward compatible with Python 2)
More details in CheckCredentials reply
Added CheckCredentials utility method, python3 enabled
First import; working version