code: def normalized_edata(g, weight=None):
      with g.local_scope():
          if weight is None:
              weight = "W"
              g.edata[weight] = torch.ones(
                  g.number_of_edges(), device=g.device
              )
          g.update_all(fn.copy_e(weight, weight), fn.sum(weight, "v"))
          g.apply_edges(lambda edges: {"w": 1 / edges.dst["v"]})
          return g.edata["w"]
  
file_path: dgl/examples/pytorch/labor/ladies_sampler.py
imports: import dgl
  import dgl.function
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: normalized_edata(g, weight) and returns: g