<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_moc(self):
 """Write the MOC to a given file."""


        if self.moc is None:
            raise CommandError('No MOC information present for output')

        filename = self.params.pop()
        self.moc.write(filename)