py: implement __dict__ for user-defined classes