def instantiate_children(
        self,
        children_data,
        surface_maps,
    ):
        """Instantiate each child using children data.

        children_data (list of dicts)
            data used to describe children of this menu
            (commands and/or other menus) for instantiation.
        """
        children = self.children = List2D()

        for child_data, surface_map in zip(children_data, surface_maps):

            ### check existence of children data inside
            ### the child data
            try:
                child_data["children"]

            ### if there's no grandchildren, then the data
            ### describes a command, so instantiate a
            ### command widget

            except KeyError:

                ## instantiate command widget
                widget = Command(
                    self,
                    child_data,
                    surface_map,
                )

            ### if otherwise, there is children referenced in
            ### the data, then we are dealing with a menu,
            ### so instantiate it, passing along the
            ### its children data (grandchildren)

            else:

                ## instantiate menu widget
                widget = Menu(
                    self,
                    child_data,
                    surface_map,
                )

            ### append the widget
            children.append(widget)

        ### finally, position children relative to this
        ### menu and relative to each other

        ## assign topleft

        children.rect.topleft = (
            # if parent is menu.MenuManager, laid
            # horizontally, align the topleft of the new
            # child with the bottomleft of the pygame.Rect
            # instance in the 'rect' attribute
            self.rect.bottomleft
            if is_top_menu(self) and self.parent.is_menubar
            # all other scenarios demand that the topleft of
            # the new child should be aligned with the
            # topright of the pygame.Rect instance in the
            # 'rect' attribute
            else self.rect.topright
        )

        ## position relative to each other

        children.rect.snap_rects_ip(
            retrieve_pos_from="bottomleft", assign_pos_to="topleft"
        )
Instantiate each child using children data.

        children_data (list of dicts)
            data used to describe children of this menu
            (commands and/or other menus) for instantiation.
        
nodezator/menu/submenu/main.py