@classmethod
def has_connection(cls, pid, connection):
    """Check to see if a pool has the specified connection

        :param str pid: The pool ID
        :param connection: The connection to check for
        :type connection: psycopg2.extensions.connection
        :rtype: bool

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