code: def write(self, filename):
          
          ext = os.path.splitext(filename)[1]
          writer = open(filename, 'w')
          if ext == '.py':
              writer.write(pprint.pformat(self))
          elif ext == '.yaml':
              writer.write(yaml.dump(self))
          else:
              writer.close()
              raise Exception('Unrecognized config format: %s'%ext)
          writer.close()
docs: Write a copy of this config object.
  
          Parameters:
          -----------
          outfile : output filename
          
          Returns:
          --------
          None