'mac address of interface to exclude'

@staticmethod
def settingsNetworkManager(interface=str, Remove=False):

    networkmanager = '/etc/NetworkManager/NetworkManager.conf'
    config = configparser.RawConfigParser()
    MAC = Refactor.get_interface_mac(interface)
    exclude = {'MAC': 'mac:{}'.format(MAC), 'interface': 'interface-name:{}'.format(interface)}
    if (not Remove):
        if path.exists(networkmanager):
            config.read(networkmanager)
            try:
                config.add_section('keyfile')
            except configparser.DuplicateSectionError as e:
                config.set('keyfile', 'unmanaged-devices', '{}'.format((exclude['MAC'] if (MAC != None) else exclude['interface'])))
            else:
                config.set('keyfile', 'unmanaged-devices', '{}'.format((exclude['MAC'] if (MAC != None) else exclude['interface'])))
            finally:
                with open(networkmanager, 'wb') as configfile:
                    config.write(configfile)
            return True
        return False
    elif Remove:
        if path.exists(networkmanager):
            config.read(networkmanager)
            try:
                config.remove_option('keyfile', 'unmanaged-devices')
                with open(networkmanager, 'wb') as configfile:
                    config.write(configfile)
                    return True
            except configparser.NoSectionError:
                return True
        return False
