def index_nearest_shape(point, r_tree, shape_index_dict):
    """Returns the index of the nearest Shapely shape to a Shapely point.
    Uses a Shapely STRtree (R-tree) to perform a faster lookup"""
    result = None
    if point.is_valid:  # Point(nan, nan) is not valid (also not empty) in 1.8
        geom = r_tree.nearest(point)
        result = shape_index_dict[id(geom)]
    return result