def throttle(actor_ref, action, **kw):
  """ enforces throttling of some action per user with defined limits
  """
  if actor_ref and actor_ref.nick == settings.ROOT_NICK:
    return

  already_throttled = False
  for k, v in kw.iteritems():
    if BUCKETS in k:
      throttled = throttle_status(actor_ref, action, bucket=k, max=v)
      
      # if anything is throttled we will raise an error in the end
      if throttled and not already_throttled:
        already_throttled = k

      # for any thresholds not yet hit increase the count
      if not throttled:
        throttle_inc(actor_ref, action, bucket=k)
        
  if already_throttled:
    raise exception.ApiThrottled(
        'Too many attempts this %s' % already_throttled)
dataset/ETHPy150Open CollabQ/CollabQ/common/throttle.py/throttle/swapped operands of `in`