code: def markup(self, text: str, **markup: bool) -> str:
      for name in markup:
          if name not in self._esctable:
              raise ValueError(f"unknown markup: {name!r}")
      if self.hasmarkup:
          esc = [
              self._esctable[name] for name, on in markup.items() if on
          ]
          if esc:
              text = (
                  "".join("\x1b[%sm" % cod for cod in esc)
                  + text
                  + "\x1b[0m"
              )
      return text
  
imports: import os
  import shutil
  import sys
  from typing import Optional
  from typing import Sequence
  from typing import TextIO
  from .wcwidth import wcswidth
  from _pytest.compat import final
label_desc: Use image node_id 5 for calling the TerminalWriter obj's underlying member method code with example usage: obj.markup(text) and returns: text