def CompareProperty(obj, key, value):
  """Compare the property value for the given key with the given value."""
  if not hasattr(obj, key) or str(getattr(obj, key)) != str(value):
    return False
  return True