import shlex


def shlex_join(split_command):
    """Return a shell-escaped string from *split_command*.

    This is from Python 3.8:
    https://github.com/python/cpython/blob/3.8/Lib/shlex.py

    XXX: Obsolete with 3.8.
    """
    return ' '.join(shlex.quote(arg) for arg in split_command)