Use cls instead of self for class methods

Python convention is to use "cls" for class methods
and to use "self" for instance methods.
Merge pull request #748 from legoktm/cls

Use cls instead of self for class methods