<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_string(self, metadata=False):
 """Returns a string with the history. Set metadata to True to have info on function and module."""

        return "\n".join(rec.get_message(metadata=metadata) for rec in self)