<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def instances(self):
 """Iterate over the instances of the class."""

        ist = lib.EnvGetNextInstanceInClass(self._env, self._cls, ffi.NULL)

        while ist != ffi.NULL:
            yield Instance(self._env, ist)

            ist = lib.EnvGetNextInstanceInClass(self._env, self._cls, ist)