def get_factory_by_class(self, klass):
for check, factory in self._factories.items():<EOL><INDENT>if klass is check:<EOL><INDENT>return factory(self, klass)<EOL><DEDENT><DEDENT>for check, factory in self._factories.items():<EOL><INDENT>if issubclass(klass, check):<EOL><INDENT>return factory(self, klass)<EOL><DEDENT><DEDENT>return klass<EOL>
Returns a custom factory for class. By default it will return the class itself.

:param klass: Class type
:type klass: type
:return: Class factory
:rtype: callable