code: def getobjpath(obj, path):
      
      if not path:
          return obj
      if path.startswith("["):
          item = path[1:path.index("]")]
          return getobjpath(obj[item], path[len(item) + 2:])
      if path.startswith("."):
          path = path[1:]
      if "." in path or "[" in path:
          dot_idx = path.find(".")
          bracket_idx = path.find("[")
          if dot_idx == -1 or bracket_idx < dot_idx:
              idx = bracket_idx
              next_idx = idx
          else:
              idx = dot_idx
              next_idx = idx + 1
          attr = path[:idx]
          return getobjpath(getattr(obj, attr), path[next_idx:])
      return getattr(obj, path)
docs: Returns an item or attribute of the object recursively.
      Item names are specified between brackets, eg: [item].
      Attribute names are prefixed with a dot (the first one is optional), eg: .attr
      Example: getobjpath(obj, "attr1.attr2[item].attr3")