def _EscapePosixShellArgument(arg):
  """Escapes a shell command line argument so that it is interpreted literally.

  Args:
    arg: The shell argument to escape.

  Returns:
    The escaped string.
  """
  return "'%s'" % arg.replace("'", "'\\''")