code: def data_received(self, data):
          
          self._data_buffer += data.decode()
          if not self._data_buffer.endswith('\r\n'):
              return
          data = self._data_buffer
          self._data_buffer = ''  # clear buffer
          for cmd in data.strip().split('\r\n'):
              data = json.loads(cmd)
              if not isinstance(data, list):
                  data = [data]
              for item in data:
                  self.handle_data(item)
docs: Handle received data.