Time-out for ssh in popen

Here is a very simple implementation of a time-out for a ssh command executed in popen.

#!/usr/bin/python3
import os

def main():
    node = 'haspp99'
    com = "timeout 3 ssh -x  root@%s \"lsb_release -a\"" % (node)
    lines = os.popen( com).readlines()
    if len( lines) == 0: 
        print( "bad reply from %s" % node)
    else:
        print( "reply %s" % repr( lines))
    return

if __name__ == "__main__":
    main()