def read(self, size):
        """Read the first 'size' bytes in packet and advance cursor past them."""
        result = self._data[self._position : (self._position + size)]
        if len(result) != size:
            error = (
                "Result length not requested length:\n"
                f"Expected={size}.  Actual={len(result)}.  Position: {self._position}.  Data Length: {len(self._data)}"
            )
            if DEBUG:
                print(error)
                self.dump()
            raise AssertionError(error)
        self._position += size
        return result
Read the first 'size' bytes in packet and advance cursor past them.
pymysql/protocol.py