code: def calc_local_reach_dist(
      set_index: set,
      neighborhoods: dict,
      reach_dist: dict,
      local_reach_dist: dict,
  ):
      """
      Calculate local reachability distance of affected points.
      """
      for i in set_index:
          denominator = sum(reach_dist[i][j] for j in neighborhoods[i])
          local_reach_dist[i] = (
              len(neighborhoods[i]) / denominator if denominator else 0
          )
      return local_reach_dist
  
imports: from __future__ import annotations
  import copy
  import functools
  import pandas
  from river import anomaly, utils
  from river.neighbors.base import DistanceFunc
label_desc: Use image node_id 6 for calling a global function with example usage: calc_local_reach_dist(set_index, neighborhoods, reach_dist, local_reach_dist) and returns: local_reach_dist