<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_members(self, name, members, mode=None):
 """Configures the array of member interfaces for the Port-Channel Args: name(str):
 The Port-Channel interface name to configure the member interfaces members(list):
 The list of Ethernet interfaces that should be member interfaces mode(str):
 The LACP mode to configure the member interfaces to. Valid values are 'on, 'passive', 'active'. When there are existing channel-group members and their lacp mode differs from this attribute, all of those members will be removed and then re-added using the specified lacp mode. If this attribute is omitted, the existing lacp mode will be used for new member additions. Returns: True if the operation succeeds otherwise False """

        commands = list()
        grpid = re.search(r'(\d+)', name).group()
        current_members = self.get_members(name)
        lacp_mode = self.get_lacp_mode(name)
        if mode and mode != lacp_mode:
            lacp_mode = mode
            self.set_lacp_mode(grpid, lacp_mode)

        # remove members from the current port-channel interface
        for member in set(current_members).difference(members):
            commands.append('interface %s' % member)
            commands.append('no channel-group %s' % grpid)

        # add new member interfaces to the port-channel interface
        for member in set(members).difference(current_members):
            commands.append('interface %s' % member)
            commands.append('channel-group %s mode %s' % (grpid, lacp_mode))

        return self.configure(commands) if commands else True