<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def toggle_white_spaces(self):
 """ Toggles document white spaces display. :return: Method success. :rtype: bool """


        text_option = self.get_default_text_option()
        if text_option.flags().__int__():
            text_option = QTextOption()
            text_option.setTabStop(self.tabStopWidth())
        else:
            text_option.setFlags(
                text_option.flags() | QTextOption.ShowTabsAndSpaces | QTextOption.ShowLineAndParagraphSeparators)
        self.set_default_text_option(text_option)
        return True