<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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]