<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _get_session():
    '''
    Get a connection to the XenServer host
    '''
    api_version = '1.0'
    originator = 'salt_cloud_{}_driver'.format(__virtualname__)
    url = config.get_cloud_config_value(
        'url',
        get_configured_provider(),
        __opts__,
        search_global=False
    )
    user = config.get_cloud_config_value(
        'user',
        get_configured_provider(),
        __opts__,
        search_global=False
    )
    password = config.get_cloud_config_value(
        'password',
        get_configured_provider(),
        __opts__,
        search_global=False
    )
    ignore_ssl = config.get_cloud_config_value(
        'ignore_ssl',
        get_configured_provider(),
        __opts__,
        default=False,
        search_global=False
    )
    try:
        session = XenAPI.Session(url, ignore_ssl=ignore_ssl)
        log.debug(
            'url: %s user: %s password: %s, originator: %s',
            url, user, 'XXX-pw-redacted-XXX', originator
        )
        session.xenapi.login_with_password(
            user, password, api_version, originator)
    except XenAPI.Failure as ex:
        pool_master_addr = six.text_type(ex.__dict__['details'][1])
        slash_parts = url.split('/')
        new_url = '/'.join(slash_parts[:2]) + '/' + pool_master_addr
        session = XenAPI.Session(new_url)
        log.debug(
            'session is -> url: %s user: %s password: %s, originator:%s',
            new_url, user, 'XXX-pw-redacted-XXX', originator
        )
        session.xenapi.login_with_password(
            user, password, api_version, originator)
    return session