def ParseInteger(text, is_signed=False, is_long=False):
  """Parses an integer.

  Args:
    text: The text to parse.
    is_signed: True if a signed integer must be parsed.
    is_long: True if a long integer must be parsed.

  Returns:
    The integer value.

  Raises:
    ValueError: Thrown Iff the text is not a valid integer.
  """

  try:
    result = int(text, 0)
  except ValueError:
    raise ValueError(text % 'Couldn\'t parse integer: %s')


  checker = _INTEGER_CHECKERS[2 * int(is_long) + int(is_signed)]
  checker.CheckValue(result)
  return result
dataset/ETHPy150Open AppScale/appscale/AppServer/google/net/proto2/python/public/text_format.py/ParseInteger/swapped operands of `%`