<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_matching_link(self, mode, group, addr):
 """Find a matching link in the current device. Mode: r | c is the mode of the link in the linked device This method will search for a corresponding link in the reverse direction. group: All-Link group number addr: Inteon address of the linked device """

        found_rec = None
        mode_test = None
        if mode.lower() in ['c', 'r']:
            link_group = int(group)
            link_addr = Address(addr)
            for mem_addr in self:
                rec = self[mem_addr]
                if mode.lower() == 'r':
                    mode_test = rec.control_flags.is_controller
                else:
                    mode_test = rec.control_flags.is_responder
                if (mode_test and
                        rec.group == link_group and
                        rec.address == link_addr):
                    found_rec = rec
        return found_rec