code: def prepare_tag(self, tag):
      if not tag:
          raise EmitterError("tag must not be empty")
      if tag == "!":
          return tag
      handle = None
      suffix = tag
      prefixes = sorted(self.tag_prefixes.keys())
      for prefix in prefixes:
          if tag.startswith(prefix) and (
              prefix == "!" or len(prefix) < len(tag)
          ):
              handle = self.tag_prefixes[prefix]
              suffix = tag[len(prefix) :]
      chunks = []
      start = end = 0
      while end < len(suffix):
          ch = suffix[end]
          if (
              "0" <= ch <= "9"
              or "A" <= ch <= "Z"
              or "a" <= ch <= "z"
              or ch in "-;/?:@&=+$,_.~*'()[]"
              or (ch == "!" and handle != "!")
          ):
              end += 1
          else:
              if start < end:
                  chunks.append(suffix[start:end])
              start = end = end + 1
              data = ch.encode("utf-8")
              for ch in data:
                  chunks.append("%%%02X" % ch)
      if start < end:
          chunks.append(suffix[start:end])
      suffix_text = "".join(chunks)
      if handle:
          return "%s%s" % (handle, suffix_text)
      else:
          return "!<%s>" % suffix_text
  
imports: from .error import YAMLError
  from .events import *
label_desc: Use image node_id 43 for calling the Emitter obj's underlying member method code with example usage: obj.prepare_tag(tag) and returns: tag, unknown, unknown