<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def flush(self):
 """Flush changes to record."""

        files = self.dumps()
        # Do not create `_files` when there has not been `_files` field before
        # and the record still has no files attached.
        if files or '_files' in self.record:
            self.record['_files'] = files