code: def corenlp_to_xmltree(s, prune_root=True):
      
      # Convert input object to dictionary
      s = get_as_dict(s)
  
      # Use the dep_parents array as a guide: ensure it is present and a list of
      # ints
      if not ("dep_parents" in s and isinstance(s["dep_parents"], list)):
          raise ValueError(
              "Input CoreNLP object must have a 'dep_parents' attribute which is a list"
          )
      try:
          dep_parents = list(map(int, s["dep_parents"]))
      except Exception:
          raise ValueError("'dep_parents' attribute must be a list of ints")
  
      # Also ensure that we are using CoreNLP-native indexing
      # (root=0, 1-base word indexes)!
      b = min(dep_parents)
      if b != 0:
          dep_parents = list(map(lambda j: j - b, dep_parents))
  
      # Parse recursively
      root = corenlp_to_xmltree_sub(s, dep_parents, 0)
  
      # Often the return tree will have several roots, where one is the actual
      # root and the rest are just singletons not included in the dep tree
      # parse...
      # We optionally remove these singletons and then collapse the root if only
      # one child left.
      if prune_root:
          for c in root:
              if len(c) == 0:
                  root.remove(c)
          if len(root) == 1:
              root = root.findall("./*")[0]
      return XMLTree(root, words=s["words"])
docs: Transforms an object with CoreNLP dep_path and dep_parent attributes into
      an XMLTree. Will include elements of any array having the same dimensiion
      as dep_* as node attributes. Also adds special word_idx attribute
      corresponding to original sequence order in sentence.