<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def size(cls, pid):
 """Return the number of connections in the pool :param str pid: The pool id :rtype int """

        with cls._lock:
            cls._ensure_pool_exists(pid)
            return len(cls._pools[pid])