code: def highlight_block(
      self,
      source: str,
      lang: str,
      opts: dict | None = None,
      force: bool = False,
      location: Any = None,
      **kwargs: Any,
  ) -> str:
      if not isinstance(source, str):
          source = source.decode()
  
      lexer = self.get_lexer(source, lang, opts, force, location)
  
      # highlight via Pygments
      formatter = self.get_formatter(**kwargs)
      try:
          hlsource = highlight(source, lexer, formatter)
      except ErrorToken as err:
          # this is most probably not the selected language,
          # so let it pass un highlighted
          if lang == "default":
              lang = "none"  # automatic highlighting failed.
          else:
              logger.warning(
                  __(
                      'Lexing literal_block %r as "%s" resulted in an error at token: %r. '
                      "Retrying in relaxed mode."
                  ),
                  source,
                  lang,
                  str(err),
                  type="misc",
                  subtype="highlighting_failure",
                  location=location,
              )
              if force:
                  lang = "none"
              else:
                  force = True
          lexer = self.get_lexer(source, lang, opts, force, location)
          hlsource = highlight(source, lexer, formatter)
  
      if self.dest == "html":
          return hlsource
      else:
          # MEMO: this is done to escape Unicode chars with non-Unicode engines
          return texescape.hlescape(hlsource, self.latex_engine)
  
file_path: sphinx/sphinx/highlighting.py
imports: from __future__ import annotations
  from functools import partial
  from importlib import import_module
  from typing import TYPE_CHECKING, Any
  from pygments import highlight
  from pygments.filters import ErrorToken
  from pygments.formatters import HtmlFormatter, LatexFormatter
  from pygments.lexers import CLexer, PythonConsoleLexer, PythonLexer, RstLexer, TextLexer, get_lexer_by_name, guess_lexer
  from pygments.styles import get_style_by_name
  from pygments.util import ClassNotFound
  from sphinx.locale import __
  from sphinx.pygments_styles import NoneStyle, SphinxStyle
  from sphinx.util import logging, texescape
label_desc: Use image node_id 5 for calling the PygmentsBridge obj's underlying member method code with example usage: obj.highlight_block(source, lang, opts, force, location) and returns: hlsource, texescape