def _AsInt(x):
  """Converts text to int.

  Args:
      x: input value.
  Returns:
      Integer value of x, or None.
  """
  try:
    i = int(x)
    return i
  except (ValueError, TypeError):
    return None