'Handle a bug in SC API that gives a full url.'

def _get_async_url(self, asyncTask):

    try:
        url = asyncTask.get('returnValue').split('https://')[1].split('/', 1)[1]
    except IndexError:
        url = asyncTask.get('returnValue')
    except AttributeError:
        LOG.debug('_get_async_url:    Attribute    Error.    (%r)', asyncTask)
        url = 'api/rest/ApiConnection/AsyncTask/'
    if (not url):
        LOG.debug('_get_async_url:    No    URL.    (%r)', asyncTask)
        url = 'api/rest/ApiConnection/AsyncTask/'
    if url.endswith('/'):
        id = asyncTask.get('instanceId')
        if id:
            LOG.debug('_get_async_url:    url    format    error.    (%r)', asyncTask)
            url = (url + id)
        else:
            LOG.error('_get_async_url:    Bogus    return    async    task    %r', asyncTask)
            raise exception.VolumeBackendAPIException(message=_('_get_async_url:    Invalid    URL.'))
    if (url.startswith('<') and url.endswith('>')):
        LOG.error('_get_async_url:    Malformed    URL    (XML    returned).    (%r)', asyncTask)
        raise exception.VolumeBackendAPIException(message=_('_get_async_url:    Malformed    URL.'))
    return url
