'Return dict-like structure of server\'s console urls.
The actual console url is lazily resolved on access.'

def get_console_urls(self, server):

    nc = self.client
    mks_version = self.V2_8
    class ConsoleUrls(collections.Mapping, ):
        def __init__(self, server):
            self.console_method = server.get_console_url
            self.support_console_types = ['novnc', 'xvpvnc', 'spice-html5', 'rdp-html5', 'serial', 'webmks']
        def __getitem__(self, key):
            try:
                if (key not in self.support_console_types):
                    raise exceptions.UnsupportedConsoleType(key)
                if (key == 'webmks'):
                    data = nc(mks_version).servers.get_console_url(server, key)
                else:
                    data = self.console_method(key)
                console_data = data.get('remote_console', data.get('console'))
                url = console_data['url']
            except exceptions.UnsupportedConsoleType as ex:
                url = ex.message
            except Exception as e:
                url = (_('Cannot    get    console    url:    %s') % six.text_type(e))
            return url
        def __len__(self):
            return len(self.support_console_types)
        def __iter__(self):
            return (key for key in self.support_console_types)
    return ConsoleUrls(server)
