<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_secondary_ips(self, name, vrid, secondary_ips, run=True):
 """Configure the secondary_ip property of the vrrp Notes: set_secondary_ips takes a list of secondary ip addresses which are to be set on the virtal router. An empty list will remove any existing secondary ip addresses from the vrrp. A list containing addresses will configure the virtual router with only the addresses specified in the list - any existing addresses not included in the list will be removed. Args: name (string):
 The interface to configure. vrid (integer):
 The vrid number for the vrrp to be managed. secondary_ips (list):
 A list of secondary ip addresses to be assigned to the virtual router. run (boolean):
 Set to True to execute the command, False to return a string with the formatted command. Returns: If run is True, returns True if the command executed successfully, error if failure. If run is False, returns the formatted command string which can be passed to the node """


        cmds = []

        # Get the current set of tracks defined for the vrrp
        curr_sec_ips = []
        vrrps = self.get(name)
        if vrrps and vrid in vrrps:
            curr_sec_ips = vrrps[vrid]['secondary_ip']

        # Validate the list of ip addresses
        for sec_ip in secondary_ips:
            if type(sec_ip) is not str or \
                    not re.match(r'^\d+\.\d+\.\d+\.\d+$', sec_ip):
                raise ValueError("vrrp property 'secondary_ip' must be a list "
                                 "of properly formatted ip address strings")

        intersection = list(set(curr_sec_ips) & set(secondary_ips))

        # Delete the intersection from both lists to determine which
        # addresses need to be added or removed from the vrrp
        remove = list(set(curr_sec_ips) - set(intersection))
        add = list(set(secondary_ips) - set(intersection))

        # Build the commands to add and remove the secondary ip addresses
        for sec_ip in remove:
            cmds.append("no vrrp %d ip %s secondary" % (vrid, sec_ip))

        for sec_ip in add:
            cmds.append("vrrp %d ip %s secondary" % (vrid, sec_ip))

        cmds = sorted(cmds)

        # Run the command if requested
        if run:
            result = self.configure_interface(name, cmds)
            # And verify the command succeeded
            if result is False:
                return self.error
            return result

        # Otherwise return the formatted command
        return cmds