def __repr__(self):
        """Return nearest unambiguous string representation.

        Since the menu manager object is too complex to
        have its instantiation call or contents faithfully
        communicated through a string representation, we
        stick to returning the some of the most relevant
        __init__ arguments and the string representation
        of each children.

        Overrides object.__repr__.
        """
        ### define a base text
        base_text = "MenuManager instance\n"

        ### add the number of direct children info
        base_text += "Direct children: " + str(len(self.children))

        ### change the base text to indicate the menu is
        ### scrollable if it is the case
        if self.is_scrollable():
            base_text += ", scrollable"

        ### gather some of the menu manager more relevant
        ### __init__ arguments using a special format and
        ### add them to the base text

        ## gather names of attribute containing relevant
        ## data

        attr_names = (
            "loop_holder",
            "boundaries_rect",
            "is_menubar",
        )

        ## retrieve the maximum length between the names
        ## and increment by 2 to compensate for padding

        max_len = max(len(attr_name) for attr_name in attr_names)

        max_len += 2

        ## define the padding, the separator and a final
        ## string variable to gather the formated text
        ## displaying the arguments data

        padding = "  "
        sep = " : "
        final_str = ""

        ## iterate over the attr names building custom
        ## formated strings with data about the relevant
        ## arguments

        for attr_name in attr_names:

            # key is the some padding plus the attr_name
            key = padding + attr_name

            # adjust key to be left justified using the
            # max_len
            key = key.ljust(max_len, " ")

            # value is the repr string of the attribute
            value = repr(getattr(self, attr_name))

            # put together the custom formated string for
            # this piece of data
            custom_formatted_str = key + sep + value

            # finally concatenate the formatted string with
            # the accumulated pieces of data in the final
            # string variable
            final_str += custom_formatted_str + ",\n"

        ## add another piece of text implying the menu
        ## manager has more data which were not disclosed
        final_str += "  [...]"

        ### increment the base text with the final string
        ### containing the data about the arguments
        base_text += ", {\n" + final_str + "\n}"

        ### increment the base text again with a caption to
        ### indicate we'll be listing the menu tree
        base_text += "\n\nTree structure:\n"

        ### finally return the base text plus each children
        ### string representation, separated by a new line
        ### character

        return "\n".join([base_text, *map(repr, self.children)])
Return nearest unambiguous string representation.

        Since the menu manager object is too complex to
        have its instantiation call or contents faithfully
        communicated through a string representation, we
        stick to returning the some of the most relevant
        __init__ arguments and the string representation
        of each children.

        Overrides object.__repr__.
        
nodezator/menu/main.py