code: def _write_file(self, slug, folderpath, html):
          
          # check directories
          if not os.path.isdir(folderpath):
              try:
                  os.makedirs(folderpath)
                  self.info("Creating directory " + folderpath)
              except Exception as e:
                  self.err(e)
                  return
          # construct file path
          filepath = folderpath + "/" + slug + ".html"
          # write the file
          try:
              filex = open(filepath, "w")
              filex.write(html)
              filex.close()
              if self.notebook is False:
                  self.ok("File written to", filepath)
              else:
                  html = '<a href="' + filepath + '">' + filepath + '</a>'
                  self.html("File written to", html)
          except Exception as e:
              self.err(e)
          return filepath
docs: Writes a chart's html to a file