code: def from_dict(dct):
      
      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))
docs: Convert a dictionary into a configtree.