def METHOD_NAME(key):
    if key == 32:  # Pause
        while True:
            key = cv.waitKey(0)
            if key == 27 or key == 32 or key == 13:  # enter: resume, space: next frame, esc: exit
                break
    else:
        key = cv.waitKey(1)
    return key