code: def set_canari_mode(mode=CanariMode.Unknown):
      
      global canari_mode
      old_mode = canari_mode
      canari_mode = mode
      return old_mode
docs: 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.