port (some of) hidapi to python