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

def _setup_conn(**kwargs):
    '''
    Setup kubernetes API connection singleton
    '''
    kubeconfig = kwargs.get('kubeconfig') or __salt__['config.option']('kubernetes.kubeconfig')
    kubeconfig_data = kwargs.get('kubeconfig_data') or __salt__['config.option']('kubernetes.kubeconfig-data')
    context = kwargs.get('context') or __salt__['config.option']('kubernetes.context')

    if (kubeconfig_data and not kubeconfig) or (kubeconfig_data and kwargs.get('kubeconfig_data')):
        with tempfile.NamedTemporaryFile(prefix='salt-kubeconfig-', delete=False) as kcfg:
            kcfg.write(base64.b64decode(kubeconfig_data))
            kubeconfig = kcfg.name

    if not (kubeconfig and context):
        if kwargs.get('api_url') or __salt__['config.option']('kubernetes.api_url'):
            salt.utils.versions.warn_until('Sodium',
                    'Kubernetes configuration via url, certificate, username and password will be removed in Sodiom. '
                    'Use \'kubeconfig\' and \'context\' instead.')
            try:
                return _setup_conn_old(**kwargs)
            except Exception:
                raise CommandExecutionError('Old style kubernetes configuration is only supported up to python-kubernetes 2.0.0')
        else:
            raise CommandExecutionError('Invalid kubernetes configuration. Parameter \'kubeconfig\' and \'context\' are required.')
    kubernetes.config.load_kube_config(config_file=kubeconfig, context=context)

    # The return makes unit testing easier
    return {'kubeconfig': kubeconfig, 'context': context}