<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_dict(dct):
 """ Convert a dictionary into a configtree. """

    def inner(d):
        results = []
        for name, v in d.items():
            if isinstance(v, dict):
                results.append(Section(name=name, children=from_dict(v)))
            elif isinstance(v, list):
                if not any(isinstance(i, dict) for i in v):
                    results.append(Directive(name=name, attrs=v))
                else:
                    for i in v:
                        if isinstance(i, dict):
                            results.append(Section(name=name, children=from_dict(i)))
                        elif isinstance(i, list):
                            results.append(Directive(name=name, attrs=i))
                        else:
                            results.append(Directive(name=name, attrs=[i]))
            else:
                results.append(Directive(name, attrs=[v]))
        return results
    return Root(children=inner(dct))