Process next packet if present

def next_packet(self):
        """
        Process next packet if present
        """
        try:
            start_byte_index = self.buffer.index(velbus.START_BYTE)
        except ValueError:
            self.buffer = bytes([])
            return
        if start_byte_index >= 0:
            self.buffer = self.buffer[start_byte_index:]
        if self.valid_header_waiting() and self.valid_body_waiting():
            next_packet = self.extract_packet()
            self.buffer = self.buffer[len(next_packet):]
            message = self.parse(next_packet)
            if isinstance(message, velbus.Message):
                self.controller.new_message(message)