<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def alloc(self):
 """ Allocate an ID value and return it. Raises: ValueError: Out of capacity in ID pool. """

        if not self._free:
            self._expand()
        id = self._free.pop()
        self._used.add(id)
        return id