Mapping over custom task group classes

The Mapping over task groups section has an example about dynamic mapping over task groups decorated with @task_group. However, if we use custom task group classes (as mentioned in the Custom task group classes section), which don’t have the expand method, how do we do dynamic mapping?