'Transfer and run a module along with its arguments.'

def _execute_module(self, module_name=None, module_args=None, tmp=None, task_vars=None, persist_files=False, delete_remote_tmp=True, wrap_async=False):

    if (task_vars is None):
        task_vars = dict()
    remote_module_path = None
    args_file_path = None
    remote_files = []
    if (module_name is None):
        module_name = self._task.action
    if (module_args is None):
        module_args = self._task.args
    self._update_module_args(module_name, module_args, task_vars)
    (module_style, shebang, module_data, module_path) = self._configure_module(module_name=module_name, module_args=module_args, task_vars=task_vars)
    display.vvv(('Using    module    file    %s' % module_path))
    if ((not shebang) and (module_style != 'binary')):
        raise AnsibleError(('module    (%s)    is    missing    interpreter    line' % module_name))
    if (not self._is_pipelining_enabled(module_style, wrap_async)):
        if ((not tmp) or ('tmp' not in tmp)):
            tmp = self._make_tmp_path()
        remote_module_filename = self._connection._shell.get_remote_filename(module_path)
        remote_module_path = self._connection._shell.join_path(tmp, remote_module_filename)
    if (module_style in ('old', 'non_native_want_json', 'binary')):
        args_file_path = self._connection._shell.join_path(tmp, 'args')
    if (remote_module_path or (module_style != 'new')):
        display.debug(('transferring    module    to    remote    %s' % remote_module_path))
        if (module_style == 'binary'):
            self._transfer_file(module_path, remote_module_path)
        else:
            self._transfer_data(remote_module_path, module_data)
        if (module_style == 'old'):
            args_data = ''
            for (k, v) in iteritems(module_args):
                args_data += ('%s=%s    ' % (k, shlex_quote(text_type(v))))
            self._transfer_data(args_file_path, args_data)
        elif (module_style in ('non_native_want_json', 'binary')):
            self._transfer_data(args_file_path, json.dumps(module_args))
        display.debug('done    transferring    module    to    remote')
    environment_string = self._compute_environment_string()
    if (tmp and remote_module_path):
        remote_files = [tmp, remote_module_path]
    if args_file_path:
        remote_files.append(args_file_path)
    sudoable = True
    in_data = None
    cmd = ''
    if wrap_async:
        (async_module_style, shebang, async_module_data, async_module_path) = self._configure_module(module_name='async_wrapper', module_args=dict(), task_vars=task_vars)
        async_module_remote_filename = self._connection._shell.get_remote_filename(async_module_path)
        remote_async_module_path = self._connection._shell.join_path(tmp, async_module_remote_filename)
        self._transfer_data(remote_async_module_path, async_module_data)
        remote_files.append(remote_async_module_path)
        async_limit = self._task.async
        async_jid = str(random.randint(0, 999999999999))
        interpreter = shebang.replace('#!', '').strip()
        async_cmd = [interpreter, remote_async_module_path, async_jid, async_limit, remote_module_path]
        if environment_string:
            async_cmd.insert(0, environment_string)
        if args_file_path:
            async_cmd.append(args_file_path)
        else:
            async_cmd.append('_')
        if (not self._should_remove_tmp_path(tmp)):
            async_cmd.append('-preserve_tmp')
        cmd = '    '.join((to_text(x) for x in async_cmd))
    else:
        if self._is_pipelining_enabled(module_style):
            in_data = module_data
        else:
            cmd = remote_module_path
        rm_tmp = None
        if (self._should_remove_tmp_path(tmp) and (not persist_files) and delete_remote_tmp):
            if ((not self._play_context.become) or (self._play_context.become_user == 'root')):
                rm_tmp = tmp
        cmd = self._connection._shell.build_module_command(environment_string, shebang, cmd, arg_path=args_file_path, rm_tmp=rm_tmp).strip()
        if (module_name == 'accelerate'):
            sudoable = False
    if remote_files:
        remote_files = [x for x in remote_files if x]
        self._fixup_perms2(remote_files, self._play_context.remote_user)
    res = self._low_level_execute_command(cmd, sudoable=sudoable, in_data=in_data)
    data = self._parse_returned_data(res)
    tmpdir_delete = ((not data.pop('_ansible_suppress_tmpdir_delete', False)) and wrap_async)
    self._remove_internal_keys(data)
    if (((self._play_context.become and (self._play_context.become_user != 'root')) and (not persist_files) and delete_remote_tmp) or tmpdir_delete):
        self._remove_tmp_path(tmp)
    if wrap_async:
        data['changed'] = True
    if (('stdout' in data) and ('stdout_lines' not in data)):
        txt = (data.get('stdout', None) or u'')
        data['stdout_lines'] = txt.splitlines()
    if (('stderr' in data) and ('stderr_lines' not in data)):
        txt = (data.get('stderr', None) or u'')
        data['stderr_lines'] = txt.splitlines()
    display.debug(('done    with    _execute_module    (%s,    %s)' % (module_name, module_args)))
    return data
