docs: def _verify_safe(self, this):
          """Make sure we are not trying to write an invalid character."""
          context = self._context
          if context & contexts.FAIL_NEXT:
              return False
          if context & contexts.WIKILINK_TITLE:
              if this == "]" or this == "{":
                  self._context |= contexts.FAIL_NEXT
              elif this == "\n" or this == "[" or this == "}" or this == ">":
                  return False
              elif this == "<":
                  if self._read(1) == "!":
                      self._context |= contexts.FAIL_NEXT
                  else:
                      return False
              return True
          elif context & contexts.EXT_LINK_TITLE:
              return this != "\n"
          elif context & contexts.TEMPLATE_NAME:
              if this == "{":
                  self._context |= contexts.HAS_TEMPLATE | contexts.FAIL_NEXT
                  return True
              if this == "}" or (this == "<" and self._read(1) == "!"):
                  self._context |= contexts.FAIL_NEXT
                  return True
              if this == "[" or this == "]" or this == "<" or this == ">":
                  return False
              if this == "|":
                  return True
              if context & contexts.HAS_TEXT:
                  if context & contexts.FAIL_ON_TEXT:
                      if this is self.END or not this.isspace():
                          return False
                  elif this == "\n":
                      self._context |= contexts.FAIL_ON_TEXT
              elif this is self.END or not this.isspace():
                  self._context |= contexts.HAS_TEXT
              return True
          elif context & contexts.TAG_CLOSE:
              return this != "<"
          else:
              if context & contexts.FAIL_ON_EQUALS:
                  if this == "=":
                      return False
              elif context & contexts.FAIL_ON_LBRACE:
                  if this == "{" or (self._read(-1) == self._read(-2) == "{"):
                      if context & contexts.TEMPLATE:
                          self._context |= contexts.FAIL_ON_EQUALS
                      else:
                          self._context |= contexts.FAIL_NEXT
                      return True
                  self._context ^= contexts.FAIL_ON_LBRACE
              elif context & contexts.FAIL_ON_RBRACE:
                  if this == "}":
                      self._context |= contexts.FAIL_NEXT
                      return True
                  self._context ^= contexts.FAIL_ON_RBRACE
              elif this == "{":
                  self._context |= contexts.FAIL_ON_LBRACE
              elif this == "}":
                  self._context |= contexts.FAIL_ON_RBRACE
              return True