def _parse_cgroup_ids(cgroup_info):
    """Returns a dictionary of subsystems to their cgroup.

    Arguments:
      cgroup_info: An iterable where each item is a line of a cgroup file.

    """

    cgroup_ids = {}

    for line in cgroup_info:
        parts = line.split(':')
        if len(parts) != 3:
            continue

        _, subsystems, cgroup_id = parts
        subsystems = subsystems.split(',')

        for subsystem in subsystems:
            cgroup_ids[subsystem] = cgroup_id

    return cgroup_ids