<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_lacp_mode(self, name, mode):
 """Configures the LACP mode of the member interfaces Args: name(str):
 The Port-Channel interface name to configure the LACP mode mode(str):
 The LACP mode to configure the member interfaces to. Valid values are 'on, 'passive', 'active' Returns: True if the operation succeeds otherwise False """

        if mode not in ['on', 'passive', 'active']:
            return False

        grpid = re.search(r'(\d+)', name).group()

        remove_commands = list()
        add_commands = list()

        for member in self.get_members(name):
            remove_commands.append('interface %s' % member)
            remove_commands.append('no channel-group %s' % grpid)
            add_commands.append('interface %s' % member)
            add_commands.append('channel-group %s mode %s' % (grpid, mode))

        return self.configure(remove_commands + add_commands)