original_docstring: 
      Prepare network trace for further testing
      
docstring: Prepare network trace for further testing
docstring_tokens: Prepare network trace for further testing
code: def GetTrace(idp_name, package_name, version, launcher_activity, proxy_port, \
      change_account=True, with_access_token=True, revoke_access_token=True, reset=False, \
      uiconfig='uiaction.json', user='Eve1', port='4723', system_port=8200, tracefile='eveA.trace', \
      emulator_name=None, snapshot_tag=None):
      """
      Prepare network trace for further testing
      """
      running_logger.debug("Recording tracefile %s", tracefile)
  
      # init
      rawTrace = None
      idpPackageName = None
      idpActivityName = None
      if idp_name == 'sina':
          idpPackageName = 'com.sina.weibo'
          idpActivityName = 'com.sina.weibo.SplashActivity'
      elif idp_name == 'wechat':
          idpPackageName = 'com.tencent.mm'
          idpActivityName = 'com.tencent.mm.ui.LauncherUI'
  
      # change account for twice
      if change_account and (emulator_name is None or snapshot_tag is None):
          mitmdump = launch_mitmdump(proxy_port)
          uictrl = UI_controller(port, system_port=system_port, package_name=idpPackageName, activity_name=idpActivityName, emulator_name=emulator_name)
          running_logger.debug('Try to change account')
          for _ in range(3):
              try:
                  if uictrl.idp_login(user, idp_name):
                      break
              except Exception as e:
                  running_logger.warn(e)
                  continue
          else:
              mitmdump.terminate()
              raise Exception("Unable to login idp")
          mitmdump.terminate()
  
      # try to get trace for 5 times
      for _ in range(5):
          try:
              if get_single_trace(proxy_port, tracefile, port, system_port, uiconfig, package_name, launcher_activity, emulator_name, snapshot_tag, idp_name, reset, user, with_access_token, version, revoke_access_token):
                  break
          except AssertionError:
              running_logger.warn('Wait too long for status change')
              continue
          except Exception as e:
              running_logger.exception(e)
              continue
      else:
          raise Exception("Cannot get network trace file in package: {}, trace file: {}".format(package_name, tracefile))
  
      return rawTrace
code_tokens: def GetTrace ( idp_name , package_name , version , launcher_activity , proxy_port , change_account = True , with_access_token = True , revoke_access_token = True , reset = False , uiconfig = 'uiaction.json' , user = 'Eve1' , port = '4723' , system_port = 8200 , tracefile = 'eveA.trace' , emulator_name = None , snapshot_tag = None ) : running_logger . debug ( "Recording tracefile %s" , tracefile ) rawTrace = None idpPackageName = None idpActivityName = None if idp_name == 'sina' : idpPackageName = 'com.sina.weibo' idpActivityName = 'com.sina.weibo.SplashActivity' elif idp_name == 'wechat' : idpPackageName = 'com.tencent.mm' idpActivityName = 'com.tencent.mm.ui.LauncherUI' if change_account and ( emulator_name is None or snapshot_tag is None ) : mitmdump = launch_mitmdump ( proxy_port ) uictrl = UI_controller ( port , system_port = system_port , package_name = idpPackageName , activity_name = idpActivityName , emulator_name = emulator_name ) running_logger . debug ( 'Try to change account' ) for _ in range ( 3 ) : try : if uictrl . idp_login ( user , idp_name ) : break except Exception as e : running_logger . warn ( e ) continue else : mitmdump . terminate ( ) raise Exception ( "Unable to login idp" ) mitmdump . terminate ( ) for _ in range ( 5 ) : try : if get_single_trace ( proxy_port , tracefile , port , system_port , uiconfig , package_name , launcher_activity , emulator_name , snapshot_tag , idp_name , reset , user , with_access_token , version , revoke_access_token ) : break except AssertionError : running_logger . warn ( 'Wait too long for status change' ) continue except Exception as e : running_logger . exception ( e ) continue else : raise Exception ( "Cannot get network trace file in package: {}, trace file: {}" . format ( package_name , tracefile ) ) return rawTrace
short_docstring: Prepare network trace for further testing
short_docstring_tokens: Prepare network trace for further testing
comment: """
      Prepare network trace for further testing
      """$SEP$# init$SEP$# change account for twice$SEP$# try to get trace for 5 times