human
I wrote the below code

    def keep_bounds(num, max_val):
        out = max(num, 0)
        out = min(out, max_val)
        return out
    gaps = copy.deepcopy(gaps)
    distances = copy.deepcopy(distances)
    locs = np.zeros([length, 2], dtype=int)
    locs[0, :] = start_locs
    total_length = ((max_locs[0] - start_locs[0]) - sum(gaps))
    if (total_length < length):
        raise ValueError('Cannot    generate    ridge    line    according    to    constraints')
    dist_int = ((length / len(distances)) - 1)
    gap_int = ((length / len(gaps)) - 1)
    for ind in xrange(1, length):
        nextcol = locs[((ind - 1), 1)]
        nextrow = (locs[((ind - 1), 0)] + 1)
        if (((ind % dist_int) == 0) and (len(distances) > 0)):
            nextcol += (((-1) ** ind) * distances.pop())
        if (((ind % gap_int) == 0) and (len(gaps) > 0)):
            nextrow += gaps.pop()
        nextrow = keep_bounds(nextrow, max_locs[0])
        nextcol = keep_bounds(nextcol, max_locs[1])
        locs[ind, :] = [nextrow, nextcol]
    return [locs[:, 0], locs[:, 1]]

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def _gen_ridge_line(start_locs, max_locs, length, distances, gaps):