Take a tree and check what types of children (i.e. 'nucleus' or
    'satellite') it has. Returns a map from child tree type to the indices of
    all children with that type.

def get_child_types(tree):
    """Take a tree and check what types of children (i.e. 'nucleus' or
    'satellite') it has. Returns a map from child tree type to the indices of
    all children with that type.
    """
    child_types = defaultdict(list)
    for i, child in enumerate(tree):
        child_types[get_tree_type(child)].append(i)
    return child_types