<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def contents(self):
 r"""Returns all contents in this expression. Optionally includes whitespace if set when node was created. ['hi'] ['\n', 'hi'] """

        for content in self.all:
            is_whitespace = isinstance(content, str) and content.isspace()
            if not is_whitespace or self.preserve_whitespace:
                yield content