code: def getparent(d, pth):
          
  
          c = d
          for key in pth[:-1]:
              if not isinstance(c, dict):
                  raise InvalidValueError(c)
              elif key not in c:
                  raise UnknownKeyError(pth)
              else:
                  c = c.__getitem__(key)
          return c
docs: Get the parent node of a subdict as specified by the key path in
          `pth`.
  
          Parameters
          ----------
          d : dict
            Dict tree in which access is required
          pth : str or tuple of str
            Dict key