<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def log(self, msg, error=False):
 """Log message helper."""

        output = self.stdout
        if error:
            output = self.stderr

        output.write(msg)
        output.write('\n')