docs: def render_entry(entry_id, slug_text='', category=''):
      """ Render an entry page.
  
      Arguments:
  
      entry_id -- The numeric ID of the entry to render
      slug_text -- The expected URL slug text
      category -- The expected category
      """
  
      # pylint: disable=too-many-return-statements
  
      # check if it's a valid entry
      record = model.Entry.get(id=entry_id)
      if not record:
          # It's not a valid entry, so see if it's a redirection
          path_redirect = get_redirect()
          if path_redirect:
              return path_redirect
  
          logger.info("Attempted to retrieve nonexistent entry %d", entry_id)
          raise http_error.NotFound("No such entry")
  
      # see if the file still exists
      if not os.path.isfile(record.file_path):
          expire_record(record)
  
          # See if there's a redirection
          path_redirect = get_redirect()
          if path_redirect:
              return path_redirect
  
          raise http_error.NotFound("No such entry")
  
      # Show an access denied error if the entry has been set to draft mode
      if record.status == model.PublishStatus.DRAFT.value:
          raise http_error.Forbidden("Entry not available")
      # Show a gone error if the entry has been deleted
      if record.status == model.PublishStatus.GONE.value:
          raise http_error.Gone()
  
      # check if the canonical URL matches
      if record.category != category or record.slug_text != slug_text:
          # This could still be a redirected path...
          path_redirect = get_redirect()
          if path_redirect:
              return path_redirect
  
          # Redirect to the canonical URL
          return redirect(url_for('entry',
                                  entry_id=entry_id,
                                  category=record.category,
                                  slug_text=record.slug_text))
  
      # if the entry canonically redirects, do that now
      entry_redirect = record.redirect_url
      if entry_redirect:
          return redirect(entry_redirect)
  
      entry_template = (record.entry_template
                        or Category(category).get('Entry-Template')
                        or 'entry')
  
      tmpl = map_template(category, entry_template)
      if not tmpl:
          raise http_error.BadRequest("Missing entry template")
  
      # Get the viewable entry
      entry_obj = Entry(record)
  
      # does the entry-id header mismatch? If so the old one is invalid
      if int(entry_obj.get('Entry-ID')) != record.id:
          expire_record(record)
          return redirect(url_for('entry', entry_id=int(entry_obj.get('Entry-Id'))))
  
      rendered, etag = render_publ_template(
          tmpl,
          _url_root=request.url_root,
          entry=entry_obj,
          category=Category(category))
  
      if request.if_none_match.contains(etag):
          return 'Not modified', 304
  
      return rendered, {'Content-Type': mime_type(tmpl),
                        'ETag': etag}