def METHOD_NAME(events, tags):
  """Parse summaries from events with simple_value.
  Args:
    events: List of tensorflow.Event protos.
    tags: List of string event tags corresponding to simple_value summaries.
  Returns:
    dict of tag:value.
  Raises:
   ValueError: if a summary with a specified tag does not contain simple_value.
  """
  step_by_tag = {}
  value_by_tag = {}
  for e in events:
    if e.HasField('summary'):
      for v in e.summary.value:
        tag = v.tag
        if tag in tags:
          if not v.HasField('simple_value'):
            raise ValueError('Summary for %s is not a simple_value.' % tag)
          # The events are mostly sorted in step order, but we explicitly check
          # just in case.
          if tag not in step_by_tag or e.step > step_by_tag[tag]:
            step_by_tag[tag] = e.step
            value_by_tag[tag] = v.simple_value
  return value_by_tag