code: def v_reference_leaf_leafref(ctx, stmt):
      
  
      if (hasattr(stmt, 'i_leafref') and
          stmt.i_leafref is not None and
          stmt.i_leafref_expanded is False):
          path_type_spec = stmt.i_leafref
          not_req_inst = not(path_type_spec.require_instance)
          x = validate_leafref_path(ctx, stmt,
                                    path_type_spec.path_spec,
                                    path_type_spec.path_,
                                    accept_non_config_target=not_req_inst
          )
          if x is None:
              return
          ptr, expanded_path, path_list = x
          path_type_spec.i_target_node = ptr
          path_type_spec.i_expanded_path = expanded_path
          path_type_spec.i_path_list = path_list
          stmt.i_leafref_expanded = True
          if ptr is not None:
              chk_status(ctx, stmt, ptr)
              stmt.i_leafref_ptr = (ptr, path_type_spec.pos)
docs: Verify that all leafrefs in a leaf or leaf-list have correct path