def run(command, **kwargs):
    for key, value in six.iteritems(_run_global_settings):
        kwargs.setdefault(key, value)
    capture_output = kwargs['capture_output']
    use_shell = kwargs['use_shell']
    print_command = kwargs['print_command']
    should_return_returncode = kwargs['should_return_returncode']
    should_raise_when_fail = kwargs['should_raise_when_fail']
    should_process_output = kwargs['should_process_output']

    use_shell = '&&' in command or '||' in command or '|' in command or use_shell
    if print_command:
        print(command)
    popen = subprocess.Popen(command if use_shell else shlex.split(command),
                             stdout=subprocess.PIPE if capture_output else None,
                             stderr=subprocess.PIPE if capture_output else None,
                             shell=use_shell)

    stdout, stderr = popen.communicate()
    return_code = popen.returncode
    if return_code != 0 and should_raise_when_fail:
        raise RunCommandError('Command execution returns {}'.format(return_code))

    if capture_output:
        if should_process_output:
            stdout = _process_run_command_output(stdout)
            stderr = _process_run_command_output(stderr)

        if should_return_returncode:
            return stdout, stderr, return_code
        else:
            return stdout, stderr
    elif should_return_returncode:
        return return_code
Testing generator access to Arrays, multiple elements (char)
dataset/ETHPy150Open sodastsai/taskr/taskr/contrib/system/__init__.py/run--crossover with--dataset/ETHPy150Open PyTables/PyTables/tables/tests/test_lists.py/GeneratorTestCase.test00b_me