<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def modules(self):
 """A list of the modules, with 0 representing a bar and 1 representing a space. :rtype: list[int] """

        def _iterate_modules(bars):
            is_bar = True
            for char in map(int, bars):
                while char > 0:
                    char -= 1
                    yield 0 if is_bar else 1
                is_bar = not is_bar

        return list(_iterate_modules(self.bars))