code: async def _read_packet(self, packet_type=MysqlPacket):
          
          buff = b''
          while True:
              try:
                  packet_header = await self._read_bytes(4)
              except asyncio.CancelledError:
                  self._close_on_cancel()
                  raise
  
              btrl, btrh, packet_number = struct.unpack(
                  '<HBB', packet_header)
              bytes_to_read = btrl + (btrh << 16)
  
              # Outbound and inbound packets are numbered sequentialy, so
              # we increment in both write_packet and read_packet. The count
              # is reset at new COMMAND PHASE.
              if packet_number != self._next_seq_id:
                  raise 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
  
              try:
                  recv_data = await self._read_bytes(bytes_to_read)
              except asyncio.CancelledError:
                  self._close_on_cancel()
                  raise
  
              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(buff, self._encoding)
          packet.check_error()
          return packet
docs: Read an entire "mysql packet" in its entirety from the network
          and return a MysqlPacket type that represents the results.