def SetPanicMode(mode, enabled):
  """Set a panic mode on or off.

  Args:
    mode: str, mode to set
    enabled: bool, to enable or disable the mode
  """
  if mode not in PANIC_MODES:
    raise ValueError(mode)

  q = models.KeyValueCache.get_by_key_name((PANIC_MODE_PREFIX, mode) % '%s%s')

  if enabled:
    if not q:
      q = models.KeyValueCache(key_name='%s%s' % (PANIC_MODE_PREFIX, mode))
      q.text_value = '1'
      q.put()
  else:
    if q:
      q.delete()

  models.KeyValueCache.ResetMemcacheWrap('%s%s' % (PANIC_MODE_PREFIX, mode))
dataset/ETHPy150Open google/simian/src/simian/mac/munki/common.py/SetPanicMode/swapped operands of `%`