client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('192.168.1.16', port=22, username='admin', password='admin',
    timeout=3, banner_timeout=2)
channel = client.invoke_shell()
print(channel.closed)
command = 'reboot'
channel.send(command + '\n')
print(channel.closed)
How to know if a paramiko SSH channel is disconnected?