def METHOD_NAME(self):
    """
    Canceller of DoPattern task.
    """
    logging.debug("Cancelling pattern scan...")
    with self._pattern_lock:
        if self._pattern_state == FINISHED:
            logging.debug("Pattern scan already finished.")
            return False
        self._pattern_state = CANCELLED
        logging.debug("Pattern scan cancelled.")
    return True