code: def write_file(name, text, opts):
      
      fname = path.join(opts.destdir, '%s.%s' % (name, opts.suffix))
      if opts.dryrun:
          print 'Would create file %s.' % fname
          return
      if not opts.force and path.isfile(fname):
          print 'File %s already exists, skipping.' % fname
      else:
          print 'Creating file %s.' % fname
          f = open(fname, 'w')
          try:
              f.write(text)
          finally:
              f.close()
docs: Write the output file for module/package <name>.