code: def login(confluence_url, user=None, api_entrypoint='confluence2'):
      
      server = ServerProxy(confluence_url + '/rpc/xmlrpc')
      user = user or getpass.getuser()
      password = getpass.getpass('Please enter confluence password for %s: ' % user)
  
      if api_entrypoint in (None, 'confluence1'):
        # TODO(???) didn't handle this JSirois review comment:
        #   Can you just switch on in create_html_page?
        #   Alternatively store a lambda here in each branch.
        api = server.confluence1
        fmt = 'markdown'
      elif api_entrypoint == 'confluence2':
        api = server.confluence2
        fmt = 'xhtml'
      else:
        raise ConfluenceError("Don't understand api_entrypoint %s" % api_entrypoint)
  
      try:
        return Confluence(api, confluence_url, api.login(user, password), fmt)
      except XMLRPCError as e:
        raise ConfluenceError('Failed to log in to %s: %s' % (confluence_url, e))
docs: Prompts the user to log in to confluence, and returns a Confluence object.
      :param confluence_url: Base url of wiki, e.g. https://confluence.atlassian.com/
      :param user: Username
      :param api_entrypoint: 'confluence1' or None results in Confluence 3.x. The default
                             value is 'confluence2' which results in Confluence 4.x or 5.x
      :rtype: returns a connected Confluence instance
      raises ConfluenceError if login is unsuccessful.