Specify Sphinx domains for classes in docstrings
Use __metaclass__ for backwards-compatibility with python2