def transform_login(config):
    """
    Parse login data as dict. Called from load_from_file and
    also can be used when collecting information from other
    sources as well.

    :param dict data: data representing the valid key/value pairs
           from smcrc
    :return: dict dict of settings that can be sent into session.login
    """
    verify = True
    if config.pop('smc_ssl', None):
        scheme = 'https'

        verify = config.pop('ssl_cert_file', None)
        if config.pop('verify_ssl', None):    
            # Get cert path to verify
            if not verify:  # Setting omitted or already False
                verify = False
        else:
            verify = False
    else:
        scheme = 'http'
        config.pop('verify_ssl', None)
        config.pop('ssl_cert_file', None)
        verify = False

    transformed = {}
    url = '{}://{}:{}'.format(
        scheme,
        config.pop('smc_address', None),
        config.pop('smc_port', None))

    timeout = config.pop('timeout', None)
    if timeout:
        try:
            timeout = int(timeout)
        except ValueError:
            timeout = None

    api_version = config.pop('api_version', None)
    if api_version:
        try:
            float(api_version)
        except ValueError:
            api_version = None
    
    transformed.update(
        url=url,
        api_key=config.pop('smc_apikey', None),
        api_version=api_version,
        verify=verify,
        timeout=timeout,
        domain=config.pop('domain', None)) 
    
    if config:
        transformed.update(kwargs=config) # Any remaining args
    
    return transformed
def transform_login ( config ) : verify = True if config . pop ( 'smc_ssl' , None ) : scheme = 'https' verify = config . pop ( 'ssl_cert_file' , None ) if config . pop ( 'verify_ssl' , None ) : if not verify : verify = False else : verify = False else : scheme = 'http' config . pop ( 'verify_ssl' , None ) config . pop ( 'ssl_cert_file' , None ) verify = False transformed = { } url = '{}://{}:{}' . format ( scheme , config . pop ( 'smc_address' , None ) , config . pop ( 'smc_port' , None ) ) timeout = config . pop ( 'timeout' , None ) if timeout : try : timeout = int ( timeout ) except ValueError : timeout = None api_version = config . pop ( 'api_version' , None ) if api_version : try : float ( api_version ) except ValueError : api_version = None transformed . update ( url = url , api_key = config . pop ( 'smc_apikey' , None ) , api_version = api_version , verify = verify , timeout = timeout , domain = config . pop ( 'domain' , None ) ) if config : transformed . update ( kwargs = config ) return transformed
Parse login data as dict. Called from load_from_file and
    also can be used when collecting information from other
    sources as well.

    :param dict data: data representing the valid key/value pairs
           from smcrc
    :return: dict dict of settings that can be sent into session.login