<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _change_state(interface, new_state):
    '''
    Enable or disable an interface

    Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot.

    :param interface: interface label
    :param new_state: up or down
    :return: True if the service was enabled, otherwise an exception will be thrown.
    :rtype: bool
    '''
    if __grains__['lsb_distrib_id'] == 'nilrt':
        return _change_state_legacy(interface, new_state)
    service = _interface_to_service(interface)
    if not service:
        raise salt.exceptions.CommandExecutionError('Invalid interface name: {0}'.format(interface))
    connected = _connected(service)
    if (not connected and new_state == 'up') or (connected and new_state == 'down'):
        service = pyconnman.ConnService(os.path.join(SERVICE_PATH, service))
        try:
            state = service.connect() if new_state == 'up' else service.disconnect()
            return state is None
        except Exception:
            raise salt.exceptions.CommandExecutionError('Couldn\'t {0} service: {1}\n'
                                                        .format('enable' if new_state == 'up' else 'disable', service))
    return True