<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def swo_flush(self, num_bytes=None):
 """Flushes data from the SWO buffer. After this method is called, the flushed part of the SWO buffer is empty. If ``num_bytes`` is not present, flushes all data currently in the SWO buffer. Args: self (JLink):
 the ``JLink`` instance num_bytes (int):
 the number of bytes to flush Returns: ``None`` Raises: JLinkException: on error """

        if num_bytes is None:
            num_bytes = self.swo_num_bytes()

        buf = ctypes.c_uint32(num_bytes)
        res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.FLUSH,
                                             ctypes.byref(buf))
        if res < 0:
            raise errors.JLinkException(res)

        return None