def sanity_check(module, host, key, sshkeygen):
 if (key is None):
  return
 try:
  outf = tempfile.NamedTemporaryFile()
  outf.write(key)
  outf.flush()
 except IOError:
  e = get_exception()
  module.fail_json(msg=('Failed to write to temporary file %s: %s' % (outf.name, str(e))))
 (rc, stdout, stderr) = module.run_command([sshkeygen, '-F', host, '-f', outf.name], check_rc=True)
 try:
  outf.close()
 except:
  pass
 if (stdout == ''):
  module.fail_json(msg='Host parameter does not match hashed host field in supplied key')

def sanity_check ( module , host , key , sshkeygen ) : if ( key is None ) : return try : outf = tempfile . NamedTemporaryFile ( ) outf . write ( key ) outf . flush ( ) except IOError : e = get_exception ( ) module . fail_json ( msg = ( 'Failed to write to temporary file %s: %s' % ( outf . name , str ( e ) ) ) ) ( rc , stdout , stderr ) = module . run_command ( [ sshkeygen , '-F' , host , '-f' , outf . name ] , check_rc = True ) try : outf . close ( ) except : pass if ( stdout == '' ) : module . fail_json ( msg = 'Host parameter does not match hashed host field in supplied key' )
check supplied key is sensible host and key are parameters provided by the user; if the host provided is inconsistent with the key supplied .