'Return value indicates if host should be cleaned up.'

@pure_driver_debug_trace
def _disconnect_host(self, array, host_name, vol_name):

    try:
        array.disconnect_host(host_name, vol_name)
    except purestorage.PureHTTPError as err:
        with excutils.save_and_reraise_exception() as ctxt:
            if ((err.code == 400) and (ERR_MSG_NOT_CONNECTED in err.text)):
                ctxt.reraise = False
                LOG.error('Disconnection    failed    with    message:    %(msg)s.', {'msg': err.text})
    connections = None
    try:
        connections = array.list_host_connections(host_name, private=True)
    except purestorage.PureHTTPError as err:
        with excutils.save_and_reraise_exception() as ctxt:
            if ((err.code == 400) and (ERR_MSG_NOT_EXIST in err.text)):
                ctxt.reraise = False
    host_still_used = bool(connections)
    if (GENERATED_NAME.match(host_name) and (not host_still_used)):
        LOG.info('Attempting    to    delete    unneeded    host    %(host_name)r.', {'host_name': host_name})
        try:
            array.delete_host(host_name)
            host_still_used = False
        except purestorage.PureHTTPError as err:
            with excutils.save_and_reraise_exception() as ctxt:
                if (err.code == 400):
                    if (ERR_MSG_NOT_EXIST in err.text):
                        ctxt.reraise = False
                        host_still_used = False
                        LOG.debug('Purity    host    deletion    failed:    %(msg)s.', {'msg': err.text})
                    if (ERR_MSG_EXISTING_CONNECTIONS in err.text):
                        ctxt.reraise = False
                        host_still_used = True
                        LOG.debug('Purity    host    deletion    ignored:    %(msg)s', {'msg': err.text})
    return (not host_still_used)
