def _auth(profile=None):
    '''
    Set up openstack credentials
    '''
    if profile:
        credentials = __salt__['config.option'](profile)
        user = credentials['keystone.user']
        password = credentials.get('keystone.password', None)
        tenant = credentials['keystone.tenant']
        auth_url = credentials['keystone.auth_url']
        auth_version = credentials.get('keystone.auth_version', 2)
        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)
    else:
        user = __salt__['config.option']('keystone.user')
        password = __salt__['config.option']('keystone.password', None)
        tenant = __salt__['config.option']('keystone.tenant')
        auth_url = __salt__['config.option']('keystone.auth_url')
        auth_version = __salt__['config.option']('keystone.auth_version', 2)
        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')
    kwargs = {
        'user': user,
        'password': password,
        'key': api_key,
        'tenant_name': tenant,
        'auth_url': auth_url,
        'auth_version': auth_version,
        'region_name': region_name
    }

    return suos.SaltSwift(**kwargs)
Set up openstack credentials