def get_port(line):
  """Get port number out of a line like "some message: localhost:[port]."""
  stripped = line.strip()
  separator_index = stripped.rfind(':')
  return int(stripped[separator_index+1:])