@classmethod
def _ensure_pool_exists(cls, pid):
    """Raise an exception if the pool has yet to be created or has been
        removed.

        :param str pid: The pool ID to check for
        :raises: KeyError

        """
    if pid not in cls._pools:
        raise KeyError('Pool %s has not been created' % pid)
