'Mark this connection as invalidated.
This method can be called directly, and is also called as a result
of the :meth:`.Connection.invalidate` method.   When invoked,
the DBAPI connection is immediately closed and discarded from
further use by the pool.  The invalidation mechanism proceeds
via the :meth:`._ConnectionRecord.invalidate` internal method.
.. seealso::
:ref:`pool_connection_invalidation`'

def invalidate(self, e=None):

    if (self.connection is None):
        util.warn("Can't    invalidate    an    already-closed    connection.")
        return
    if self._connection_record:
        self._connection_record.invalidate(e=e)
    self.connection = None
    self._checkin()
