def METHOD_NAME(f, surf, include_ga, row, guesses, g):
    """return the endpoints (L,R) contained in the frustum f; if only one voxel both endpoints will be the same; if none both will be None
    f: frustum object
    surf: surface voxels
    row: current row
    guesses: estimates for endpoints
    g: grid boundaries"""
    # +x or right endpoint
    Rend, Lend = None, None
    check_surf_L, check_surf_R = (None, None), (None, None)
    stop = False
    Ri = guesses[1]
    ogrverts = verts_in(f, (Ri, row[0], row[1]), surf, g)
    if ogrverts == 0:
        going_in = True
    elif 1 <= ogrverts < 8:
        going_in = False
        check_surf_R = (True, Ri)
    else:
        going_in = False
    while (0 <= Ri and (g["xlo"] + (Ri) * g["dx"]) < g["xhi"]) and not stop:
        verts = verts_in(f, (Ri, row[0], row[1]), surf, g)
        if verts == 0:
            if not going_in:
                stop = True
                continue
            else:
                if Ri == guesses[0]:
                    # row is empty between guesses
                    return (None, None)
                Ri -= 1
                continue
        elif verts == 8:
            Rend = Ri
            Ri += 1
            continue
        else:
            Rend = Ri
            if going_in:
                check_surf_R = (True, Ri)
                break
            Ri += 1
    # the -x or left endpoint
    stop = False
    Li = guesses[0]
    oglverts = verts_in(f, (Li, row[0], row[1]), surf, g)
    if oglverts == 0:
        going_in = True
    elif 1 <= oglverts < 8:
        going_in = False
        check_surf_L = (True, Li)
    else:
        going_in = False
    while (0 <= Li and (g["xlo"] + (Li) * g["dx"]) < g["xhi"]) and not stop:
        verts = verts_in(f, (Li, row[0], row[1]), surf, g)
        if verts == 0:
            if not going_in:
                stop = True
                continue
            else:
                # it's not empty or would have already returned
                Li += 1
                continue
        elif verts == 8:
            Lend = Li
            Li -= 1
            continue
        else:
            Lend = Li
            if going_in:
                check_surf_L = (True, Li)
                break
            Li -= 1
    # check for extra surface voxels missed
    if check_surf_R[0] and Lend is not None:
        r = check_surf_R[1]
        while r > Lend:
            verts = verts_in(f, (r, row[0], row[1]), surf, g)
            if verts == 8:
                break
            else:
                r -= 1
    if check_surf_L[0] and Rend is not None:
        l = check_surf_L[1]
        while l < Rend:
            verts = verts_in(f, (l, row[0], row[1]), surf, g)
            if verts == 8:
                break
            else:
                l += 1
    # if keeping non-surface but grid-adjacent voxels:
    if include_ga:
        surf.add((Lend, row[0], row[1]))
        surf.add((Rend, row[0], row[1]))
    return (Lend, Rend)