<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_payload(self, data):
 """Parse length of payload and return it."""

        start = 2
        length = ord(data[1:2])
        if length == 126:
            # Payload information are an extra 2 bytes.
            start = 4
            length, = unpack(">H", data[2:4])
        elif length == 127:
            # Payload information are an extra 6 bytes.
            start = 8
            length, = unpack(">I", data[2:6])
        end = start + length
        payload = json.loads(data[start:end].decode())
        extra_data = data[end:]
        return payload, extra_data