def __init__(
        self,
        parent,
        data,
        surface_map,
    ):
        """Store variables and perform setups.

        parent (instance of menu.main.MenuManager class or
                this Menu class)
            object regarded as the parent of this Menu
            instance.
        label_text (string)
            used to generate the text surface for the menu.
        children_data (list of dicts)
            data used to describe children of this menu
            (commands and/or other menus) for instantiation.
        """
        ### store variables

        self.parent = parent
        self.label_text = data["label"]
        self.surface_map = surface_map

        ### reference the normal surface as the 'image'
        ### attribute of this menu instance and also
        ### obtain a rect from it
        ### create 'image' and 'rect' attributes

        self.image = self.surface_map["normal"]
        self.rect = self.image.get_rect()

        ### assign default expanded state
        self.is_expanded = False

        ###
        surface_maps = create_equal_surfaces(data["children"])

        ### instantiate children recursively

        self.instantiate_children(
            data["children"],
            surface_maps,
        )

        ### create and position 'body' object

        body_rect = self.children.rect.inflate(2, 2)

        self.body = Object2D.from_surface(
            surface=(
                render_rect(
                    *body_rect.size,
                    MENU_BG,
                )
            ),
            coordinates_name="topleft",
            coordinates_value=body_rect.topleft,
        )

        draw_depth_finish(self.body.image)
Store variables and perform setups.

        parent (instance of menu.main.MenuManager class or
                this Menu class)
            object regarded as the parent of this Menu
            instance.
        label_text (string)
            used to generate the text surface for the menu.
        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