dockerpty provides the functionality needed to operate the pseudo-tty (PTY) allocated to a docker container, using the Python client.