'Return the name of the given device or None if we don\'t know.'

def get_device_name(self, device):

    if (self.mac2name is None):
        url = 'http://{}/cgi-bin/luci/rpc/uci'.format(self.host)
        result = _req_json_rpc(url, 'get_all', 'dhcp', params={'auth': self.token})
        if result:
            hosts = [x for x in result.values() if ((x['.type'] == 'host') and ('mac' in x) and ('name' in x))]
            mac2name_list = [(x['mac'].upper(), x['name']) for x in hosts]
            self.mac2name = dict(mac2name_list)
        else:
            return
    return self.mac2name.get(device.upper(), None)
