def findInTree(searchNode, targetPath, heritage=None):
  """
    Searches trees for element matching path given by target
    @ In, searchNode, TreeStructure.Inputnode, the node to search in for matches
    @ In, targetPath, list(string), target modification location as e.g. [Block1, Block2, entry]
    @ In, heritage, list(TreeStructure.InputNode), chain of objects leading to the match
    @ Out, found, list(TreeStructure.InputNode), found match and parents (or None if not found)
  """
  if heritage is None:
    heritage = []
  targetRoot = targetPath[0]
  found = None
  for sub in searchNode:
    if sub.tag == targetRoot:
      # if we're done searching and we have a match, return it
      if len(targetPath) == 1:
        return heritage + [sub]
      # otherwise keep searching for appropriate children
      found = findInTree(sub, targetPath[1:], heritage=heritage)
      if found:
        break
  return found