code: def get_tree(self, *page_numbers):
          
          cache_key = "_".join(map(str, _flatten(page_numbers)))
          tree = self._parse_tree_cacher.get(cache_key)
          if tree is None:
              # set up root
              root = parser.makeelement("pdfxml")
              if self.doc.info:
                  for k, v in list(self.doc.info[0].items()):
                      k = obj_to_string(k)
                      v = obj_to_string(resolve1(v))
                      try:
                          root.set(k, v)
                      except ValueError as e:
                          # Sometimes keys have a character in them, like ':',
                          # that isn't allowed in XML attribute names.
                          # If that happens we just replace non-word characters
                          # with '_'.
                          if "Invalid attribute name" in e.args[0]:
                              k = re.sub('\W', '_', k)
                              root.set(k, v)
  
              # Parse pages and append to root.
              # If nothing was passed in for page_numbers, we do this for all
              # pages, but if None was explicitly passed in, we skip it.
              if not(len(page_numbers) == 1 and page_numbers[0] is None):
                  if page_numbers:
                      pages = [[n, self.get_layout(self.get_page(n))] for n in
                               _flatten(page_numbers)]
                  else:
                      pages = enumerate(self.get_layouts())
                  for n, page in pages:
                      page = self._xmlize(page)
                      page.set('page_index', obj_to_string(n))
                      page.set('page_label', self.doc.get_page_number(n))
                      root.append(page)
                  self._clean_text(root)
  
              # wrap root in ElementTree
              tree = etree.ElementTree(root)
              self._parse_tree_cacher.set(cache_key, tree)
  
          return tree
docs: Return lxml.etree.ElementTree for entire document, or page numbers
              given if any.