def fixkey(ip):
 print 'My idea of what the remote hostkey should be is wrong.'
 while True:
  ret = raw_input('Would you like me to fix this? (y/n): ')
  if (ret.lower() == 'y'):
   rep = os.popen(('ssh-keyscan %s 2> /dev/null' % ip)).read()
   return (rep or False)
  elif (ret.lower() == 'n'):
   return False
  else:
   print 'Please choose either y or n.'
   continue

def fixkey ( ip ) : print 'My idea of what the remote hostkey should be is wrong.' while True : ret = raw_input ( 'Would you like me to fix this? (y/n): ' ) if ( ret . lower ( ) == 'y' ) : rep = os . popen ( ( 'ssh-keyscan %s 2> /dev/null' % ip ) ) . read ( ) return ( rep or False ) elif ( ret . lower ( ) == 'n' ) : return False else : print 'Please choose either y or n.' continue
return a host key or false .