pyexpect: add Terminal class