def format_cmd(args):
    """
    Format the arg list appropriate for display as a command line with
    individual arguments quoted appropriately.  This is intended for logging
    or display and not as input to a command interpreter (shell).
"""
    if args is None:
        return ''
    out = ''
    if not isinstance(args, list):
        args = [str(args)]
    for arg in args:
        if out != '':
            out += ' '
        out += pipes.quote(str(arg))
    return out
Format the arg list appropriate for display as a command line with
    individual arguments quoted appropriately.  This is intended for logging
    or display and not as input to a command interpreter (shell).