code: def makeUserLoginMethod(username, password, locale=None):
        '''Return a function that will call the vim.SessionManager.Login() method
        with the given parameters.  The result of this function can be passed as
        the "loginMethod" to a SessionOrientedStub constructor.'''
        def _doLogin(soapStub):
           si = vim.ServiceInstance("ServiceInstance", soapStub)
           sm = si.content.sessionManager
           if not sm.currentSession:
              si.content.sessionManager.Login(username, password, locale)
  
        return _doLogif makeUserLoginMethod(username, password, locale=None):
        '''Return a function that will call the vim.SessionManager.Login() method
        with the given parameters.  The result of this function can be passed as
        the "loginMethod" to a SessionOrientedStub constructor.'''
        def _doLogin(soapStub):
           si = vim.ServiceInstance("ServiceInstance", soapStub)
           sm = si.content.sessionManager
           if not sm.currentSession:
              si.content.sessionManager.Login(username, password, locale)
  
        return _doLogin
docs: Return a function that will call the vim.SessionManager.Login() method
        with the given parameters.  The result of this function can be passed as
        the "loginMethod" to a SessionOrientedStub constructor.