docs: def read(cls, read, has_name=True):
          """
          Read the tag in using the reader `rd`.
          If `has_name` is `False`, skip reading the tag name.
          """
          name = cls._read_utf8(read) if has_name else None
  
          if cls is TAG_Compound:
              # A TAG_Compound is almost identical to Python's native dict()
              # object, or a Java HashMap.
              final = {}
              while True:
                  # Find the type of each tag in a compound in turn.
                  tag = read('b', 1)[0]
                  if tag == 0:
                      # A tag of 0 means we've reached TAG_End, used to terminate
                      # a TAG_Compound.
                      break
                  # We read in each tag in turn, using its name as the key in
                  # the dict (Since a compound cannot have repeating names,
                  # this works fine).
                  tmp = _tags[tag].read(read)
                  final[tmp.name] = tmp
              return cls(final, name=name)
          elif cls is TAG_List:
              # A TAG_List is a very simple homogeneous array, similar to
              # Python's native list() object, but restricted to a single type.
              tag_type, length = read('bi', 5)
              tag_read = _tags[tag_type].read
              return cls(
                  _tags[tag_type],
                  [tag_read(read, has_name=False) for x in range(0, length)],
                  name=name
              )
          elif cls is TAG_String:
              # A simple length-prefixed UTF-8 string.
              value = cls._read_utf8(read)
              return cls(value, name=name)
          elif cls is TAG_Byte_Array:
              # A simple array of (signed) bytes.
              length = read('i', 4)[0]
              return cls(read('{0}b'.format(length), length), name=name)
          elif cls is TAG_Int_Array:
              # A simple array of (signed) 4-byte integers.
              length = read('i', 4)[0]
              return cls(read('{0}i'.format(length), length * 4), name=name)
          elif cls is TAG_Long_Array:
              # A simple array of (signed) 8-byte longs.
              length = read('i', 4)[0]
              return cls(read('{0}q'.format(length), length * 8), name=name)
          elif cls is TAG_Byte:
              # A single (signed) byte.
              return cls(read('b', 1)[0], name=name)
          elif cls is TAG_Short:
              # A single (signed) short.
              return cls(read('h', 2)[0], name=name)
          elif cls is TAG_Int:
              # A signed (signed) 4-byte int.
              return cls(read('i', 4)[0], name=name)
          elif cls is TAG_Long:
              # A single (signed) 8-byte long.
              return cls(read('q', 8)[0], name=name)
          elif cls is TAG_Float:
              # A single single-precision floating point value.
              return cls(read('f', 4)[0], name=name)
          elif cls is TAG_Double:
              # A single double-precision floating point value.
              return cls(read('d', 8)[0], name=name)
          elif cls is TAG_End:
              # A End of Compound Tag
              return cls(read('2b', 2)[0], name=name)