def get_value(pairs, key):
  """Returns a the value for the given key in the given pairs.

  Args:
    pairs: A list of {"key": key, "value": value} dicts.
    key: A key whose value to get. If the key appears more than once, only
      the first value is returned.

  Returns:
    The value for the given key.
  """
  for p in pairs:
    if p['key'] == key:
      return p['value']
  return []