<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save(self, fp, mode='wb'):
 """ Save the PSD file. :param fp: filename or file-like object. :param mode: file open mode, default 'wb'. """

        if hasattr(fp, 'write'):
            self._record.write(fp)
        else:
            with open(fp, mode) as f:
                self._record.write(f)