def get_surr_rows(row, endpoints, g):
    """return list (len=4) of the rows surrounding the current one on all sides
    IF the surrounding row is within the bounds of the grid."""
    y, z = row
    surr = []
    if y >= 1:
        surr.append(((y - 1, z), endpoints))
    if z >= 1:
        surr.append(((y, z - 1), endpoints))
    if g['ylo'] + (y + 1) * g['dy'] < g['yhi']:
        surr.append(((y + 1, z), endpoints))
    if g['zlo'] + (z + 1) * g['dz'] < g['zhi']:
        surr.append(((y, z + 1), endpoints))
    return surr
