<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, filename=None):
 """ Generates output and saves to given file :param filename File name :type str or unicode """

        if filename is None:
            raise IOError('Converter#save: Undefined filename')
        cnt = self.output()
        with (open(filename, 'wb+')) as f:
            f.write(cnt.encode('utf-8'))