example code from Eli Bendersky http://eli.thegreenplace.net/2011/08/14/python-metaclasses-by-example/