def shquote(arg):
    """Quote an argument for later parsing by shlex.split()"""
    for c in '"', "'", "\\", "#":
        if c in arg:
            return repr(arg)
    if arg.split() != [arg]:
        return repr(arg)
    return arg
Quote an argument for later parsing by shlex.split()
product/gradle-plugin/src/main/python/setuptools/command/alias.py