code: def _get_session(server):
      '''
      Get session and key
      '''
      if server in _sessions:
          return _sessions[server]
  
      config = _get_spacewalk_configuration(server)
      if not config:
          raise Exception('No config for \'{0}\' found on master'.format(server))
  
      session = _get_client_and_key(config['api_url'], config['username'], config['password'])
      atexit.register(_disconnect_session, session)
  
      client = session['client']
      key = session['key']
      _sessions[server] = (client, key)
  
      return client, kef _get_session(server):
      '''
      Get session and key
      '''
      if server in _sessions:
          return _sessions[server]
  
      config = _get_spacewalk_configuration(server)
      if not config:
          raise Exception('No config for \'{0}\' found on master'.format(server))
  
      session = _get_client_and_key(config['api_url'], config['username'], config['password'])
      atexit.register(_disconnect_session, session)
  
      client = session['client']
      key = session['key']
      _sessions[server] = (client, key)
  
      return client, key
docs: Get session and key