code: def get_file(type_str, open_files, basedir):
      
      if type_str not in open_files:
          filename = type_str+".html"
          encoding = 'utf-8'
          fd = codecs.open(os.path.join(basedir, filename), 'w', encoding)
          open_files[type_str] = fd
          write_html_header(fd, type_str, encoding)
      return open_files[type_str]
docs: Get already opened file, or open and initialize a new one.