<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wait_until_loaded(self, timeout=None):
 """Wait until page object is loaded Search all page elements configured with wait=True :param timeout: max time to wait :returns: this page object instance """

        for element in self._get_page_elements():
            if hasattr(element, 'wait') and element.wait:
                from toolium.pageelements.page_element import PageElement
                if isinstance(element, PageElement):
                    # Pageelement and Group
                    element.wait_until_visible(timeout)
                if isinstance(element, PageObject):
                    # PageObject and Group
                    element.wait_until_loaded(timeout)
        return self