def nested_dict_traverse(path, d):
  """Uses path to traverse a nested dictionary and
  returns the value at the end of the path.

  Assumes path is valid, will return KeyError if it is not.
  Warning: if key is in multiple nest levels, 
  this will only return one of those values."""
  val = d
  for p in path:
    val = val[p]
  return val