@classmethod
def add(cls, pid, connection):
    """Add a new connection and session to a pool.

        :param str pid: The pool id
        :type connection: psycopg2.extensions.connection
        :param connection: The connection to add to the pool

        """
    with cls._lock:
        cls._ensure_pool_exists(pid)
        cls._pools[pid].add(connection)
