use six.with_metaclass() instead of custom stuff