import re


def ExtractThroughput(output):
  """Extract throughput from MNIST output.

  Args:
    output: MNIST output

  Returns:
    throuput float
  """
  regex = r'INFO:tensorflow:global_step/sec: (\S+)'
  match = re.findall(regex, str(output))
  return sum(float(step) for step in match) / len(match)