[python] How to generate keyboard events?