def get_factory_by_class(self, klass):
        """
        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
        """
        for check, factory in self._factories.items():
            if klass is check:
                return factory(self, klass)
        for check, factory in self._factories.items():
            if issubclass(klass, check):
                return factory(self, klass)
        return klass
def get_factory_by_class ( self , klass ) : for check , factory in self . _factories . items ( ) : if klass is check : return factory ( self , klass ) for check , factory in self . _factories . items ( ) : if issubclass ( klass , check ) : return factory ( self , klass ) return klass
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