'Get the last session ID currently in the database.
Within IPython, this should be the same as the value stored in
:attr:`HistoryManager.session_number`.'

@catch_corrupt_db
def get_last_session_id(self):

    for record in self.get_tail(n=1, include_latest=True):
        return record[0]
