Python Apply Function On Keyboard