<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def construct(path, name=None):
    "Selects an appropriate CGroup subclass for the given CGroup path."
    name = name if name else path.split("/")[4]
    classes = {"memory": Memory,
               "cpu": CPU,
               "cpuacct": CPUAcct}
    constructor = classes.get(name, CGroup)
    log.debug("Chose %s for: %s", constructor.__name__, path)
    return constructor(path, name)