def check_logged_in(console):
 console.write('\r\n\r\n')
 time.sleep(1)
 prompt = read_serial(console)
 if (('>' in prompt) or ('#' in prompt)):
  return True
 else:
  return False

def check_logged_in ( console ) : console . write ( '\r\n\r\n' ) time . sleep ( 1 ) prompt = read_serial ( console ) if ( ( '>' in prompt ) or ( '#' in prompt ) ) : return True else : return False
check if logged in to router .