code: def receive(self, event):
          
          if not isinstance(event, TraceITMEvent):
              return
          
          if not event.port == 0:
              return
          
          # Extract bytes.
          if event.width == 8:
              data = chr(event.data)
          elif event.width == 16:
              data = chr(event.data & 0xff) + chr((event.data >> 8) & 0xff)
          elif event.width == 32:
              data = (chr(event.data & 0xff)
                      + chr((event.data >> 8) & 0xff)
                      + chr((event.data >> 16) & 0xff)
                      + chr((event.data >> 24) & 0xff))
  
          self._console.write(data)
docs: ! @brief Handle an SWV trace event.
          @param self
          @param event An instance of TraceITMEvent. If the event is not this class, or isn't
              for ITM port 0, then it will be ignored. The individual bytes of 16- or 32-bit events
              will be extracted and written to the console.