code: def write(self, file_or_filename):
          
          if isinstance(file_or_filename, basestring):
              self._fcn_name, _ = splitext(basename(file_or_filename))
          else:
              self._fcn_name = self.case.name
  
          self._fcn_name = self._fcn_name.replace(",", "").replace(" ", "_")
  
          super(MATPOWERWriter, self).write(file_or_filename)
docs: Writes case data to file in MATPOWER format.