def _read_size_and_contents(self):
        """Read data that consists of the following:
            - the size of the contents encoded the same way as payload length
              of the WebSocket Protocol with 1 bit padding at the head.
            - the contents.
        """
        try:
            size = self._read_number()
        except ValueError, e:
            raise PhysicalConnectionError(_DROP_CODE_INVALID_MUX_CONTROL_BLOCK,
                                          str(e))
        pos = self._read_position
        if pos + size > len(self._data):
            raise PhysicalConnectionError(
                _DROP_CODE_INVALID_MUX_CONTROL_BLOCK,
                'Cannot read %d bytes data' % size)

        self._read_position += size
        return self._data[pos:pos+size]
dataset/ETHPy150Open google/pywebsocket/mod_pywebsocket/mux.py/_MuxFramePayloadParser._read_size_and_contents/original