'Get the last n lines from the history database.
Parameters
n : int
The number of lines to get
raw, output : bool
See :meth:`get_range`
include_latest : bool
If False (default), n+1 lines are fetched, and the latest one
is discarded. This is intended to be used where the function
is called by a user command, which it should not return.
Returns
Tuples as :meth:`get_range`'

@catch_corrupt_db
def get_tail(self, n=10, raw=True, output=False, include_latest=False):

    self.writeout_cache()
    if (not include_latest):
        n += 1
    cur = self._run_sql('ORDER    BY    session    DESC,    line    DESC    LIMIT    ?', (n,), raw=raw, output=output)
    if (not include_latest):
        return reversed(list(cur)[1:])
    return reversed(list(cur))
