Use a metaclass for creating coroutines.