code: def make_varname(tree):
      
      if tree.tag == 'identifier':
          return tree.attrib['name']
  
      if tree.tag in ('string', 'boolean'):
          return tree.text
  
      if tree.tag == 'number':
          return tree.attrib['value']
  
      if tree.tag in ('property', 'object'):
          return make_varname(_xpath_one(tree, '*'))
  
      if tree.tag.endswith('accessor'):
          kind = tree.tag[:-len('accessor')]
          obj = make_varname(_xpath_one(tree, 'object'))
          prop = make_varname(_xpath_one(tree, 'property'))
          if kind == 'dot':
              fmt = '%s.%s'
          elif kind == 'bracket':
              fmt = '%s[%s]'
          else:
              raise ValueError("Unknown accessor: %s" % tree.tag)
          return fmt % (obj, prop)
  
      raise ValueError("Unknown tag: %s" % tree.tag)
docs: <left> tree </left>