<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def do_add_all_link(self, args):
 """Add an All-Link record to the IM and a device. Usage: add_all_link [linkcode] [group] [address] Arguments: linkcode: 0 - PLM is responder 1 - PLM is controller 3 - PLM is controller or responder Default 1 group: All-Link group number (0 - 255). Default 0. address: INSTEON device to link with (not supported by all devices) """

        linkcode = 1
        group = 0
        addr = None
        params = args.split()
        if params:
            try:
                linkcode = int(params[0])
            except IndexError:
                linkcode = 1
            except ValueError:
                linkcode = None

            try:
                group = int(params[1])
            except IndexError:
                group = 0
            except ValueError:
                group = None

            try:
                addr = params[2]
            except IndexError:
                addr = None

        if linkcode in [0, 1, 3] and 255 >= group >= 0:
            self.loop.create_task(
                self.tools.start_all_linking(linkcode, group, addr))
        else:
            _LOGGING.error('Link code %d or group number %d not valid',
                           linkcode, group)
            self.do_help('add_all_link')