<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_cgroup(self, name):
 """ Delete a cgroup by name and detach it from this node. Raises OSError if the cgroup is not empty. """

        name = name.encode()
        fp = os.path.join(self.full_path, name)
        if os.path.exists(fp):
            os.rmdir(fp)
        node = Node(name, parent=self)
        try:
            self.children.remove(node)
        except ValueError:
            return