def on_mouse_release(self, event):
        """Invoke a button if mouse hovers it when released.

        Parameters
        ==========
        event (pygame.event.Event of pygame.MOUSEBUTTONUP
               type)
            We use it to retrieve the mouse position when
            the mouse left button is released; it is also
            required in order to comply w/ the protocol used;

            Check pygame.event module documentation on
            pygame website for more info about this event
            object.
        """
        ### retrieve the mouse position
        mouse_pos = event.pos

        ### itertate over the buttons

        for button in self.buttons:

            ### if a button collided with the mouse,
            ### try retrieving the mouse release method,
            ### executing it if available, then break out
            ### of the "for loop"

            if button.rect.collidepoint(mouse_pos):

                try:
                    method = getattr(button, "on_mouse_release")

                except AttributeError:
                    pass

                else:
                    method()

                break
Invoke a button if mouse hovers it when released.

        Parameters
        ==========
        event (pygame.event.Event of pygame.MOUSEBUTTONUP
               type)
            We use it to retrieve the mouse position when
            the mouse left button is released; it is also
            required in order to comply w/ the protocol used;

            Check pygame.event module documentation on
            pygame website for more info about this event
            object.
        
nodezator/our3rdlibs/sortingeditor/modes.py