docs: def unescape_newlines(s: str) -> str:
      """
      Reverses :func:`escape_newlines`.
      """
      # See also http://stackoverflow.com/questions/4020539
      if not s:
          return s
      d = ""  # the destination string
      in_escape = False
      for i in range(len(s)):
          c = s[i]  # the character being processed
          if in_escape:
              if c == "r":
                  d += "\r"
              elif c == "n":
                  d += "\n"
              else:
                  d += c
              in_escape = False
          else:
              if c == "\\":
                  in_escape = True
              else:
                  d += c
      return d