'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):
        result = self._retrieve_list_with_retry()
        if result:
            hosts = [x for x in result if (('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)
