code: def _follow_leafref(
              self, xpath: "Expr", init: "TerminalNode") -> Optional["DataNode"]:
          
          if isinstance(xpath, LocationPath):
              lft = self._follow_leafref(xpath.left, init)
              if lft is None:
                  return None
              return lft._follow_leafref(xpath.right, init)
          elif isinstance(xpath, Step):
              if xpath.axis == Axis.parent:
                  return self.data_parent()
              elif xpath.axis == Axis.child:
                  if isinstance(self, InternalNode) and xpath.qname:
                      qname = (xpath.qname if xpath.qname[1]
                               else (xpath.qname[0], init.ns))
                      return self.get_data_child(*qname)
          elif isinstance(xpath, Root):
              return self.schema_root()
          return None
docs: Return the data node referred to by a leafref path.
  
          Args:
              xpath: XPath expression compiled from a leafref path.
              init: initial context node