def _get_current_lane(self, ego_vehicle):
        """
        Called in update_localization to find current lane information. If the vehicle is in the current reference lane,
        meaning it is not yet moving to the next road segment, then return the current reference lane. Otherwise, return
        the next reference lane. If the vehicle is not in any of the reference lanes, then return the closest lane.
        """
        possible_lanes, on_lane = ray_localization(
            ego_vehicle.heading, ego_vehicle.position, ego_vehicle.engine, return_on_lane=True
        )
        for lane, index, l_1_dist in possible_lanes:
            if lane in self.current_ref_lanes:
                return lane, index, on_lane
        nx_ckpt = self._target_checkpoints_index[-1]
        if nx_ckpt == self.checkpoints[-1] or self.next_ref_lanes is None:
            return (*possible_lanes[0][:-1], on_lane) if len(possible_lanes) > 0 else (None, None, on_lane)

        if self.map.road_network_type == NodeRoadNetwork:
            nx_nx_ckpt = nx_ckpt + 1
            next_ref_lanes = self.map.road_network.graph[self.checkpoints[nx_ckpt]][self.checkpoints[nx_nx_ckpt]]
        else:
            next_ref_lanes = self.next_ref_lanes
        for lane, index, l_1_dist in possible_lanes:
            if lane in next_ref_lanes:
                return lane, index, on_lane
        return (*possible_lanes[0][:-1], on_lane) if len(possible_lanes) > 0 else (None, None, on_lane)

        Called in update_localization to find current lane information. If the vehicle is in the current reference lane,
        meaning it is not yet moving to the next road segment, then return the current reference lane. Otherwise, return
        the next reference lane. If the vehicle is not in any of the reference lanes, then return the closest lane.
        
metadrive/component/navigation_module/node_network_navigation.py