<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _resample_grid(stations, nodes, lags, mindepth, maxdepth, corners):
 """ Resample the lagtime grid to a given volume. For use if the grid from Grid2Time is too large or you want to run a faster, downsampled scan. :type stations: list :param stations: List of station names from in the form where stations[i] refers to nodes[i][:] and lags[i][:] :type nodes: list :param nodes: List of node points where nodes[i] referes to stations[i] and nodes[:][:][0] is latitude in degrees, nodes[:][:][1] is longitude in degrees, nodes[:][:][2] is depth in km. :type lags: numpy.ndarray :param lags: Array of arrays where lags[i][:] refers to stations[i]. lags[i][j] should be the delay to the nodes[i][j] for stations[i] in seconds. :type mindepth: float :param mindepth: Upper limit of volume :type maxdepth: float :param maxdepth: Lower limit of volume :type corners: matplotlib.path.Path :param corners: matplotlib Path of the corners for the 2D polygon to cut to in lat and lon. :returns: Stations :rtype: list :returns: List of lists of tuples of node locations :rtype: list :returns: Array of lags. :rtype: :class:`numpy.ndarray` .. note:: **Output:** station[1] refers to nodes[1] and lags[1] nodes[1][1] refers to station[1] and lags[1][1] nodes[n][n] is a tuple of latitude, longitude and depth. """

    resamp_nodes = []
    resamp_lags = []
    # Cut the volume
    for i, node in enumerate(nodes):
        # If the node is within the volume range, keep it
        if mindepth < float(node[2]) < maxdepth and\
           corners.contains_point(node[0:2]):
                resamp_nodes.append(node)
                resamp_lags.append([lags[:, i]])
    # Reshape the lags
    print(np.shape(resamp_lags))
    resamp_lags = np.reshape(resamp_lags, (len(resamp_lags), len(stations))).T
    # Resample the nodes - they are sorted in order of size with largest long
    # then largest lat, then depth.
    print(' '.join(['Grid now has ', str(len(resamp_nodes)), 'nodes']))
    return stations, resamp_nodes, resamp_lags