def _parsePayload(self, data):
        '''Parse the string *data* and extract cell fields.

        Set this cell's attributes from extracted values.

        :param str data: string to parse
        '''
        start, end = self.payloadRange()
        offset = start

        if end - start < HTYPE_LEN + HLEN_LEN:
            msg = "Create2Cell payload was not enough bytes to construct "
            msg += "a valid Create2Cell."
            raise BadPayloadData(msg)

        self.htype = struct.unpack('!H', data[offset:offset + HTYPE_LEN])[0]

        if self.htype != DEF.NTOR_HTYPE:
            msg = "Create2 got htype: {}, but oppy only supports ntor: {}."
            raise BadPayloadData(msg.format(self.htype, DEF.NTOR_HTYPE))

        offset += HTYPE_LEN

        self.hlen = struct.unpack('!H', data[offset:offset + HLEN_LEN])[0]

        if self.hlen != DEF.NTOR_HLEN:
            msg = "Create2 got hlen: {}, but oppy only supports ntor hlen: {}."
            raise BadPayloadData(msg.format(self.hlen, DEF.NTOR_HLEN))

        offset += HLEN_LEN

        try:
            self.hdata = data[offset:offset + self.hlen]
        except __HOLE__:
            msg = "Create2 hlen was specified to be {} bytes, but actual "
            msg += "hdata was {} bytes."
            raise BadPayloadData(msg.format(self.hlen, len(data) - offset))
dataset/ETHPy150Open nskinkel/oppy/oppy/cell/fixedlen.py/Create2Cell._parsePayload