Revised for latest Python/HexChat.