<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def software_breakpoint_set(self, addr, thumb=False, arm=False, flash=False, ram=False):
 """Sets a software breakpoint at the specified address. If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if ``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a normal breakpoint is set. If ``flash`` is ``True``, the breakpoint is set in flash, otherwise if ``ram`` is ``True``, the breakpoint is set in RAM. If both are ``True`` or both are ``False``, then the best option is chosen for setting the breakpoint in software. Args: self (JLink):
 the ``JLink`` instance addr (int):
 the address where the breakpoint will be set thumb (bool):
 boolean indicating to set the breakpoint in THUMB mode arm (bool):
 boolean indicating to set the breakpoint in ARM mode flash (bool):
 boolean indicating to set the breakpoint in flash ram (bool):
 boolean indicating to set the breakpoint in RAM Returns: An integer specifying the breakpoint handle. This handle should sbe retained for future breakpoint operations. Raises: TypeError: if the given address is not an integer. JLinkException: if the breakpoint could not be set. """

        if flash and not ram:
            flags = enums.JLinkBreakpoint.SW_FLASH
        elif not flash and ram:
            flags = enums.JLinkBreakpoint.SW_RAM
        else:
            flags = enums.JLinkBreakpoint.SW

        if thumb:
            flags = flags | enums.JLinkBreakpoint.THUMB
        elif arm:
            flags = flags | enums.JLinkBreakpoint.ARM

        handle = self._dll.JLINKARM_SetBPEx(int(addr), flags)
        if handle <= 0:
            raise errors.JLinkException('Software breakpoint could not be set.')

        return handle