def _GetEventData(data, key, value_type=None):
  """Get value for key from data.

  Args:
    data: a dict contains data.
    key: the key to get value.
    value_type: value's type.
  Returns:
    value
  """
  value = data.get(key)
  if value and value_type:
    value = value_type(value)
  return value