def _putconn(self, conn, key=None, close=False):
    'Put away a connection.'
    if self.closed:
        raise PoolError('connection pool is closed')
    if (key is None):
        key = self._rused.get(id(conn))
    if (not key):
        raise PoolError('trying to put unkeyed connection')
    if ((len(self._pool) < self.minconn) and (not close)):
        if (not conn.closed):
            status = conn.get_transaction_status()
            if (status == _ext.TRANSACTION_STATUS_UNKNOWN):
                conn.close()
            elif (status != _ext.TRANSACTION_STATUS_IDLE):
                conn.rollback()
                self._pool.append(conn)
            else:
                self._pool.append(conn)
    else:
        conn.close()
    if ((not self.closed) or (key in self._used)):
        del self._used[key]
        del self._rused[id(conn)]
Put away a connection.
def _putconn(self, conn, key=None, close=False):
    
    if self.closed:
        raise PoolError('connection pool is closed')
    if (key is None):
        key = self._rused.get(id(conn))
    if (not key):
        raise PoolError('trying to put unkeyed connection')
    if ((len(self._pool) < self.minconn) and (not close)):
        if (not conn.closed):
            status = conn.get_transaction_status()
            if (status == _ext.TRANSACTION_STATUS_UNKNOWN):
                conn.close()
            elif (status != _ext.TRANSACTION_STATUS_IDLE):
                conn.rollback()
                self._pool.append(conn)
            else:
                self._pool.append(conn)
    else:
        conn.close()
    if ((not self.closed) or (key in self._used)):
        del self._used[key]
        del self._rused[id(conn)]