def shell_quote(arg):
    """
    Quote a string argument to be safely included in a shell command line.

    :param str arg: The script argument
    :return: The argument quoted
    """
    assert arg is not None
    return "'%s'" % arg.replace("'", "'\\''")
