import re


def check_filteraction(option, opt, value): # pylint: disable=W0613
  """Custom parser for filter rule actions.

  Takes a string, returns an action as a Python object (list or string).

  The string "RATE_LIMIT n" becomes `["RATE_LIMIT", n]`.
  All other strings stay as they are.

  """
  match = re.match(r"RATE_LIMIT\s+(\d+)", value)
  if match:
    n = int(match.group(1))
    return ["RATE_LIMIT", n]
  else:
    return value