def METHOD_NAME(self, product, classtype):
    """Check if a given product is a particular type of object"""
    if classtype in self.types_keys:
        # This is now very ugly, but now it's fast :-)
        # Someone with real Python skills should fix this to be less insane.
        # Optimisations:
        # - swap order of imports, otherwise we throw ImportError
        #   almost every time
        # - cache everything we can
        try:
            type_key = 'terminatorlib.%s' % self.types[classtype]
            if type_key not in self.instance_types_keys:
                self.instance_types[type_key] = __import__(type_key, None, None, [''])
                self.instance_types_keys.append(type_key)
            module = self.instance_types[type_key]
        except ImportError:
            type_key = self.types[classtype]
            if type_key not in self.instance_types_keys:
                self.instance_types[type_key] = __import__(type_key, None, None, [''])
                self.instance_types_keys.append(type_key)
            module = self.instance_types[type_key]
        return(METHOD_NAME(product, getattr(module, classtype)))
    else:
        err('Factory::isinstance: unknown class type: %s' % classtype)
        return(False)