code: def followPath(d, path_elems):
      for path_elem in path_elems:
          if "" != path_elem:
              idx = -1
              if path_elem.endswith("]"):
                  idx = int(
                      path_elem[
                          path_elem.find("[") + 1 : path_elem.find("]")
                      ]
                  )
                  path_elem = path_elem[: path_elem.find("[")]
              assert path_elem in d, (
                  "FAIL: Failed to find key: "
                  + path_elem
                  + " in dict: "
                  + repr(d)
              )
  
              if -1 == idx:
                  d = d[path_elem]
              else:
                  d = d[path_elem][idx]
  
      return d
  
imports: import sys, os, time, json, datetime, errno, stat, getpass, requests, pprint
  import h2o
label_desc: Use image node_id 9 for calling a global function with example usage: followPath(d, path_elems) and returns: d