outlock = threading.Lock()

def workon(host):
    ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username='xy', password='xy')
stdin, stdout, stderr = ssh.exec_command(cmd)
stdin.write('xy\n')
stdin.flush()
with outlock:
    print(stdout.readlines())

def main():
    hosts = ['10.10.3.10', '10.10.4.12', '10.10.2.15']
threads = []
for h in hosts:
    t = threading.Thread(target=workon, args=(h,))
t.start()
threads.append(t)
for t in threads:
    t.join()
main()
Creating multiple SSH connections at a time using Paramiko