<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_binary_string(self, notification):
 """Unpack the notification from binary string."""

        command = struct.unpack('>B', notification[0])[0]

        if command != self.COMMAND:
            raise NotificationInvalidCommandError()

        length = struct.unpack('>I', notification[1:5])[0]
        notification = notification[5:]
        offset = 0

        def next_item(offset):
            iden, length = struct.unpack('>BH', notification[offset:offset+3])
            offset += 3
            payload = notification[offset:offset+length]
            offset += length

            if iden == self.PAYLOAD:
                payload = struct.unpack('>{0}s'.format(length), payload)[0]
                self.payload = json.loads(payload)
            elif iden == self.TOKEN:
                payload = struct.unpack('>{0}s'.format(length), payload)[0]
                self.token = binascii.hexlify(payload)
            elif iden == self.PRIORITY:
                self.priority = struct.unpack('>B', payload)[0]
            elif iden == self.NOTIFICATION_ID:
                self.iden = struct.unpack('>I', payload)[0]
            elif iden == self.EXPIRE:
                payload = struct.unpack('>I', payload)[0]
                self.expire = (self.EXPIRE_IMMEDIATELY if payload == 0 else
                               datetime.fromtimestamp(payload))
            else:
                raise NotificationInvalidIdError()

            return offset

        while offset < length:
            offset = next_item(offset)