Set up nova credentials

def _auth(profile=None, **kwargs):
    '''
    Set up nova credentials
    '''
    keystone_api_args = None
    if kwargs is not None:
        if kwargs.get('keystone_api_args') is not None:
            keystone_api_args = kwargs['keystone_api_args']

    if profile:
        credentials = __salt__['config.option'](profile)
        user = credentials['keystone.user']
        password = credentials['keystone.password']
        tenant = credentials['keystone.tenant']
        auth_url = credentials['keystone.auth_url']
        region_name = credentials.get('keystone.region_name', None)
        api_key = credentials.get('keystone.api_key', None)
        os_auth_system = credentials.get('keystone.os_auth_system', None)
        use_keystoneauth = credentials.get('keystone.use_keystoneauth', False)
    else:
        user = __salt__['config.option']('keystone.user')
        password = __salt__['config.option']('keystone.password')
        tenant = __salt__['config.option']('keystone.tenant')
        auth_url = __salt__['config.option']('keystone.auth_url')
        region_name = __salt__['config.option']('keystone.region_name')
        api_key = __salt__['config.option']('keystone.api_key')
        os_auth_system = __salt__['config.option']('keystone.os_auth_system')
        use_keystoneauth = __salt__['config.option']('keystone.use_keystoneauth')

    # Override pillar settings with settings provided by module argument
    if keystone_api_args:
        user = keystone_api_args.get('user', user)
        password = keystone_api_args.get('password', password)
        tenant = keystone_api_args.get('tenant', tenant)
        auth_url = keystone_api_args.get('auth_url', auth_url)
        region_name = keystone_api_args.get('region_name', region_name)
        api_key = keystone_api_args.get('api_key', api_key)
        os_auth_system = keystone_api_args.get('os_auth_system', os_auth_system)
        use_keystoneauth = keystone_api_args.get('use_keystoneauth', use_keystoneauth)

    if use_keystoneauth is True:
        if profile:
            credentials = __salt__['config.option'](profile)
            project_id = credentials.get('keystone.project_id', None)
            project_name = credentials.get('keystone.project_name', None)
            user_domain_name = credentials.get('keystone.user_domain_name', None)
            project_domain_name = credentials.get('keystone.project_domain_name', None)
            verify = credentials.get('keystone.verify', None)
        else:
            project_id = __salt__['config.option']('keystone.project_id')
            project_name = __salt__['config.option']('keystone.project_name')
            user_domain_name = __salt__['config.option']('keystone.user_domain_name')
            project_domain_name = __salt__['config.option']('keystone.project_domain_name')
            verify = __salt__['config.option']('keystone.verify')

        # Override pillar settings with settings provided by module argument
        if keystone_api_args:
            project_id = keystone_api_args.get('project_id', project_id)
            project_name = keystone_api_args.get('project_name', project_name)
            user_domain_name = keystone_api_args.get('user_domain_name', user_domain_name)
            project_domain_name = keystone_api_args.get('project_domain_name', project_domain_name)
            verify = keystone_api_args.get('verify', verify)

        send_kwargs = {
            'username': user,
            'password': password,
            'project_id': project_id,
            'auth_url': auth_url,
            'region_name': region_name,
            'use_keystoneauth': use_keystoneauth,
            'verify': verify,
            'project_name': project_name,
            'project_domain_name': project_domain_name,
            'user_domain_name': user_domain_name
        }
    else:
        send_kwargs = {
            'username': user,
            'password': password,
            'api_key': api_key,
            'project_id': tenant,
            'auth_url': auth_url,
            'region_name': region_name,
            'os_auth_plugin': os_auth_system
        }
    log.debug('SEND_KWARGS: %s', send_kwargs)
    return suon.SaltNova(**send_kwargs)