<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_bool(self, invert=False):
 """Return the truth value of each element."""

        if invert:
            def function(x, y):
                return False if x else True
        else:
            def function(x, y):
                return True if x else False
        return self.operation(None, function)