def move_selection(reverse=False):
    """
    Goes through the list of gunicorns, setting the selected as the one after
    the currently selected.
    """
    global selected_pid
    if selected_pid not in gunicorns:
        selected_pid = None
    found = False
    pids = sorted(gunicorns.keys(), reverse=reverse)
    # Iterate items twice to enable wrapping.
    for pid in pids + pids:
        if selected_pid is None or found:
            selected_pid = pid
            return
        found = pid == selected_pid
dataset/ETHPy150Open stephenmcd/gunicorn-console/gunicorn_console.py/move_selection/original