  
  
  def safe_shutdown():
      """ Close queues, threads and processes in event of crash """
      logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
      logger.debug("Safely shutting down")
      from lib.queue_manager import queue_manager
      from lib.multithreading import terminate_processes
      queue_manager.terminate_queues()
      terminate_processes()
 
</s> remove     queue_manager._log_queue.put(None)  # pylint: disable=protected-access
    while not queue_manager._log_queue.empty():  # pylint: disable=protected-access
 </s> add     queue_manager._log_queue.put(None)  # pylint:disable=protected-access
    while not queue_manager._log_queue.empty():  # pylint:disable=protected-access </s> remove     logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
 </s> add     logger = logging.getLogger(__name__)  # pylint:disable=invalid-name </s> remove from lib.utils import safe_shutdown
 </s> add from lib.utils import FaceswapError, safe_shutdown </s> remove     logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
 </s> add     logger = logging.getLogger(__name__)  # pylint:disable=invalid-name </s> remove     logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
 </s> add     logger = logging.getLogger(__name__)  # pylint:disable=invalid-name
    logger = logging.getLogger(__name__)  # pylint:disable=invalid-name
  
  
  def safe_shutdown():
      """ Close queues, threads and processes in event of crash """
    logger = logging.getLogger(__name__)  # pylint:disable=invalid-name
      logger.debug("Safely shutting down")
      from lib.queue_manager import queue_manager
      from lib.multithreading import terminate_processes
      queue_manager.terminate_queues()
      terminate_processes()
keep keep keep keep replace keep keep keep keep keep
 FaceswapError Exception. Added to cli and utils 
lib/utils.py