def call(cmd, stdout=PIPE, stderr=PIPE, on_error='<STR_LIT>', **kwargs):
if isinstance(cmd, (list, tuple)):<EOL><INDENT>cmdstr = '<STR_LIT:U+0020>'.join(cmd)<EOL>kwargs.setdefault('<STR_LIT>', False)<EOL><DEDENT>else:<EOL><INDENT>cmdstr = str(cmd)<EOL>kwargs.setdefault('<STR_LIT>', True)<EOL><DEDENT>proc = Popen(cmd, stdout=stdout, stderr=stderr, **kwargs)<EOL>out, err = proc.communicate()<EOL>if proc.returncode:<EOL><INDENT>if on_error == '<STR_LIT:ignore>':<EOL><INDENT>pass<EOL><DEDENT>elif on_error == '<STR_LIT>':<EOL><INDENT>e = CalledProcessError(proc.returncode, cmdstr)<EOL>warnings.warn(str(e))<EOL><DEDENT>else:<EOL><INDENT>raise CalledProcessError(proc.returncode, cmdstr)<EOL><DEDENT><DEDENT>return out.decode('<STR_LIT:utf-8>'), err.decode('<STR_LIT:utf-8>')<EOL>
Call out to the shell using `subprocess.Popen`

    Parameters
    ----------
    stdout : `file-like`, optional
        stream for stdout

    stderr : `file-like`, optional
        stderr for stderr

    on_error : `str`, optional
        what to do when the command fails, one of

        - 'ignore' - do nothing
        - 'warn' - print a warning
        - 'raise' - raise an exception

    **kwargs
        other keyword arguments to pass to `subprocess.Popen`

    Returns
    -------
    out : `str`
        the output stream of the command
    err : `str`
        the error stream from the command

    Raises
    ------
    OSError
        if `cmd` is a `str` (or `shell=True` is passed) and the executable
        is not found
    subprocess.CalledProcessError
        if the command fails otherwise