def ssh_version():
 ret = subprocess.Popen(['ssh', '-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
 try:
  version_parts = ret[1].split(',')[0].split('_')[1]
  parts = []
  for part in version_parts:
   try:
    parts.append(int(part))
   except ValueError:
    return tuple(parts)
  return tuple(parts)
 except IndexError:
  return (2, 0)

def ssh_version ( ) : ret = subprocess . Popen ( [ 'ssh' , '-V' ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) . communicate ( ) try : version_parts = ret [ 1 ] . split ( ',' ) [ 0 ] . split ( '_' ) [ 1 ] parts = [ ] for part in version_parts : try : parts . append ( int ( part ) ) except ValueError : return tuple ( parts ) return tuple ( parts ) except IndexError : return ( 2 , 0 )
returns the version of the installed ssh command .