docs: def header(heading_text, header_level, style="atx"):
      """Return a header of specified level.
  
      Keyword arguments:
          style -- Specifies the header style (default atx).
              The "atx" style uses hash signs, and has 6 levels.
              The "setext" style uses dashes or equals signs for headers of
              levels 1 and 2 respectively, and is limited to those two levels.
  
      Specifying a level outside of the style's range results in a ValueError.
  
      >>> header("Main Title", 1)
      '# Main Title'
      >>> header("Smaller subtitle", 4)
      '#### Smaller subtitle'
      >>> header("Setext style", 2, style="setext")
      'Setext style\\n---'
      """
      if not isinstance(header_level, int):
          raise TypeError("header_level must be int")
      if style not in ["atx", "setext"]:
          raise ValueError("Invalid style %s (choose 'atx' or 'setext')" % style)
      if style == "atx":
          if not 1 <= header_level <= 6:
              raise ValueError("Invalid level %d for atx" % header_level)
          return ("#" * header_level) + " " + esc_format(heading_text)
      else:
          if not 0 < header_level < 3:
              raise ValueError("Invalid level %d for setext" % header_level)
          header_character = "=" if header_level == 1 else "-"
          return esc_format(heading_text) + ("\n%s" % (header_character * 3))