<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find(self, start_address, end_address, byte_depth=20, instrs_depth=2):
 """Find gadgets. """

        self._max_bytes = byte_depth
        self._instrs_depth = instrs_depth

        if self._architecture == ARCH_X86:
            candidates = self._find_x86_candidates(start_address, end_address)
        elif self._architecture == ARCH_ARM:
            candidates = self._find_arm_candidates(start_address, end_address)
        else:
            raise Exception("Architecture not supported.")

        # Sort and return.
        return sorted(candidates, key=lambda g: g.address)