docs: def write_file(self, file_path, mime_type=None):
          """Copy from tornado.web.StaticFileHandler
          """
          if not os.path.exists(file_path):
              raise HTTPError(404)
          if not os.path.isfile(file_path):
              raise HTTPError(403, "%s is not a file", file_path)
  
          stat_result = os.stat(file_path)
          modified = datetime.datetime.fromtimestamp(stat_result[stat.ST_MTIME])
  
          self.set_header("Last-Modified", modified)
  
          if not mime_type:
              mime_type, _encoding = mimetypes.guess_type(file_path)
          if mime_type:
              self.set_header("Content-Type", mime_type)
  
          # Check the If-Modified-Since, and don't send the result if the
          # content has not been modified
          ims_value = self.request.headers.get("If-Modified-Since")
          if ims_value is not None:
              date_tuple = email.utils.parsedate(ims_value)
              if_since = datetime.datetime.fromtimestamp(time.mktime(date_tuple))
              if if_since >= modified:
                  self.set_status(304)
                  return
  
          with open(file_path, "rb") as file:
              data = file.read()
              hasher = hashlib.sha1()
              hasher.update(data)
              self.set_header("Etag", '"%s"' % hasher.hexdigest())
              self.write(data)