client = paramiko.SSHClient()
client.load_system_host_keys()
client.connect('host.example.com')
channel = client.get_transport().open_session()
channel.exec_command('tail -f /var/log/everything/current')
while True:
    if channel.exit_status_ready():
        break
rl, wl, xl = select.select([channel], [], [], 0.0)
if len(rl) > 0:
    pass
Long-running ssh commands in python paramiko module (and how to end them)