<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_canari_mode(mode=CanariMode.Unknown):
 """ Sets the global operating mode for Canari. This is used to alter the behaviour of dangerous classes like the CanariConfigParser. :param mode: the numeric Canari operating mode (CanariMode.Local, CanariMode.Remote, etc.). :return: previous operating mode. """

    global canari_mode
    old_mode = canari_mode
    canari_mode = mode
    return old_mode