human
Complete this python program:
def _ask_and_call(cmds, cwd=None):
assistant
#Here is the Python code you requested.

    """Pretty print cmds, ask if they should be run, and if so, runs
    them using _call().
    :param cmds: a list of commands executed one after another, ``list``
    :param cwd: (optional) set cwd of command that is executed, ``str``
    :returns: ``True`` if cmds were run.
    """
    def quote(s):
        return (('"%s"' % s) if ('    ' in s) else s)
    accepted = _ask('\n'.join(['    '.join([quote(s) for s in c]) for c in cmds]))
    if accepted:
        _call(cmds, cwd)
    return accepted