def ClassAsJsonDict(o, ans=None):
  """Turn all the int values from a class into a json object.

  This is useful if you have a class of constants which you wish to
  send as a json object for the Angular UI to use the same constant
  values.

  Args:
    o: a class or object with integer members.
    ans: an optional dictionary to update
  Returns:
    a dictionary of key/value pairs from the o object.
  """
  if ans is None:
    ans = {}
  for key, val in o.__dict__.items():
    if isinstance(val, int):
      ans[key] = val
  return ans