def wait_for_login(client, host, port, username, password, prompt, linesep='\n', log_filename=None, timeout=240, internal_timeout=10, interface=None):
 logging.debug('Attempting to log into %s:%s using %s (timeout %ds)', host, port, client, timeout)
 end_time = (time.time() + timeout)
 while (time.time() < end_time):
  try:
   return remote_login(client, host, port, username, password, prompt, linesep, log_filename, internal_timeout, interface)
  except LoginError as e:
   logging.debug(e)
  time.sleep(2)
 return remote_login(client, host, port, username, password, prompt, linesep, log_filename, internal_timeout, interface)

def wait_for_login ( client , host , port , username , password , prompt , linesep = '\n' , log_filename = None , timeout = 240 , internal_timeout = 10 , interface = None ) : logging . debug ( 'Attempting to log into %s:%s using %s (timeout %ds)' , host , port , client , timeout ) end_time = ( time . time ( ) + timeout ) while ( time . time ( ) < end_time ) : try : return remote_login ( client , host , port , username , password , prompt , linesep , log_filename , internal_timeout , interface ) except LoginError as e : logging . debug ( e ) time . sleep ( 2 ) return remote_login ( client , host , port , username , password , prompt , linesep , log_filename , internal_timeout , interface )
make multiple attempts to log into a remote host until one succeeds or timeout expires .