Simple python API for obtaining a keypress