def _build_shell_arguments(shell_args, apptest_url, apptest_args):
  """Builds the list of arguments for the shell.

  Args:
    shell_args: List of arguments for the shell run.
    apptest_url: Url of the apptest app to run.
    apptest_args: Parameters to be passed to the apptest app.

  Returns:
    Single list of shell arguments.
  """
  result = list(shell_args)
  if apptest_args:
    result.append("--args-for=%s %s" % (apptest_url, " ".join(apptest_args)))
  result.append(apptest_url)
  return result