human
Complete this python program:
def _execute(task, host, my_env, args, kwargs, jobs, queue, multiprocessing):
assistant
#Here is the Python code you requested.

    """Primary single-host work body of execute()
    """
    if (state.output.running and (not hasattr(task, 'return_value'))):
        print ("[%s]    Executing    task    '%s'" % (host, my_env['command']))
    local_env = to_dict(host)
    local_env.update(my_env)
    if (queue is not None):
        local_env.update({'parallel': True, 'linewise': True})
    if (queue is not None):
        name = local_env['host_string']
        def inner(args, kwargs, queue, name, env):
            state.env.update(env)
            def submit(result):
                queue.put({'name': name, 'result': result})
            try:
                state.connections.clear()
                submit(task.run(*args, **kwargs))
            except BaseException as e:
                if (e.__class__ is not SystemExit):
                    if (not (isinstance(e, NetworkError) and _is_network_error_ignored())):
                        sys.stderr.write(('!!!    Parallel    execution    exception    under    host    %r:\n' % name))
                    submit(e)
                if (not (isinstance(e, NetworkError) and _is_network_error_ignored())):
                    raise
        kwarg_dict = {'args': args, 'kwargs': kwargs, 'queue': queue, 'name': name, 'env': local_env}
        p = multiprocessing.Process(target=inner, kwargs=kwarg_dict)
        p.name = name
        jobs.append(p)
    else:
        with settings(**local_env):
            return task.run(*args, **kwargs)