def METHOD_NAME(self, window: Optional[str] = "wnd[0]") -> str:
    """Retrieves the messageType in the statusbar the given window.
    Takes screenshot on error.
    :param window: locator for the statusbar, default 'wnd[0]'
    :return: messageType of the /sbar element or empty string
    """
    return_value = ""
    try:
        return_value = self.session.findById(window + "/sbar").messageType
    except COMError as ex:
        self.take_screenshot()
        raise ValueError("Cannot find window with locator '%s'" % window) from ex
    return return_value