def collect_children(name: str, collector: dict):
    """Helper function to collect the children for a name into a dictionary."""
    out: dict = {}

    for prop, value in collector[name].items():
        if isinstance(prop, tuple):
            prop = prop[-1]
        if isinstance(value, list):
            out[prop] = [collect_children(child, collector) for child in value]
        else:
            out[prop] = value

    return out