docs: def _read_packet(self, packet_type=MysqlPacket):
          """Read an entire "mysql packet" in its entirety from the network
          and return a MysqlPacket type that represents the results.
  
          :raise OperationalError: If the connection to the MySQL server is lost.
          :raise InternalError: If the packet sequence number is wrong.
          """
          buff = bytearray()
          while True:
              packet_header = self._read_bytes(4)
              #if DEBUG: dump_packet(packet_header)
  
              btrl, btrh, packet_number = struct.unpack('<HBB', packet_header)
              bytes_to_read = btrl + (btrh << 16)
              if packet_number != self._next_seq_id:
                  self._force_close()
                  if packet_number == 0:
                      # MariaDB sends error packet with seqno==0 when shutdown
                      raise err.OperationalError(
                          CR.CR_SERVER_LOST,
                          "Lost connection to MySQL server during query")
                  raise err.InternalError(
                      "Packet sequence number wrong - got %d expected %d"
                      % (packet_number, self._next_seq_id))
              self._next_seq_id = (self._next_seq_id + 1) % 256
  
              recv_data = self._read_bytes(bytes_to_read)
              if DEBUG: dump_packet(recv_data)
              buff += recv_data
              # https://dev.mysql.com/doc/internals/en/sending-more-than-16mbyte.html
              if bytes_to_read == 0xffffff:
                  continue
              if bytes_to_read < MAX_PACKET_LEN:
                  break
  
          packet = packet_type(bytes(buff), self.encoding)
          packet.check_error()
          return packet