'Save the last visual selection and the mode it was made in.'

def conserve(self):

    (sl, sbyte) = map(int, (_vim.eval('line("\'<")'), _vim.eval('col("\'<")')))
    (el, ebyte) = map(int, (_vim.eval('line("\'>")'), _vim.eval('col("\'>")')))
    sc = byte2col(sl, (sbyte - 1))
    ec = byte2col(el, (ebyte - 1))
    self._mode = _vim.eval('visualmode()')
    _vim_line_with_eol = (lambda ln: (_vim.buf[ln] + '\n'))
    if (sl == el):
        text = _vim_line_with_eol((sl - 1))[sc:(ec + 1)]
    else:
        text = _vim_line_with_eol((sl - 1))[sc:]
        for cl in range(sl, (el - 1)):
            text += _vim_line_with_eol(cl)
        text += _vim_line_with_eol((el - 1))[:(ec + 1)]
    self._text = text
