'Close this Session.
This clears all items and ends any transaction in progress.
If this session were created with ``autocommit=False``, a new
transaction is immediately begun.  Note that this new transaction does
not use any connection resources until they are first needed.'

def close(self):

    self.expunge_all()
    if (self.transaction is not None):
        for transaction in self.transaction._iterate_parents():
            transaction.close()
