def request(self, name, *args, **kwargs):
if (self._session._loop_thread is not None<EOL>and threading.current_thread() != self._session._loop_thread):<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>.format('<STR_LIT:\n>'.join(format_stack(None, <NUM_LIT:5>)[:-<NUM_LIT:1>])))<EOL>self.async_call(self._err_cb, msg)<EOL>raise NvimError("<STR_LIT>")<EOL><DEDENT>decode = kwargs.pop('<STR_LIT>', self._decode)<EOL>args = walk(self._to_nvim, args)<EOL>res = self._session.request(name, *args, **kwargs)<EOL>return walk(self._from_nvim, res, decode=decode)<EOL>
r"""Send an API request or notification to nvim.

        It is rarely needed to call this function directly, as most API
        functions have python wrapper functions. The `api` object can
        be also be used to call API functions as methods:

            vim.api.err_write('ERROR\n', async_=True)
            vim.current.buffer.api.get_mark('.')

        is equivalent to

            vim.request('nvim_err_write', 'ERROR\n', async_=True)
            vim.request('nvim_buf_get_mark', vim.current.buffer, '.')


        Normally a blocking request will be sent.  If the `async_` flag is
        present and True, a asynchronous notification is sent instead. This
        will never block, and the return value or error is ignored.