def METHOD_NAME(self):
    # This is necessary because if the factory constructor fails
    # __del__ is executed right away but pool might not be set
    if hasattr(self, "pool"):
        self.pool.shutdown()