docs: def setup_session(endpoint_context, areq, uid, client_id='', acr='', salt='salt',
                    authn_event=None):
      """
      Setting up a user session
  
      :param endpoint_context:
      :param areq:
      :param uid:
      :param acr:
      :param client_id:
      :param salt:
      :param authn_event: A already made AuthnEvent
      :return:
      """
      if authn_event is None and acr:
          authn_event = AuthnEvent(uid=uid, salt=salt, authn_info=acr,
                                   authn_time=time.time())
  
      if not client_id:
          client_id = areq['client_id']
  
      sid = endpoint_context.sdb.create_authz_session(authn_event, areq,
                                                      client_id=client_id,
                                                      uid=uid)
      endpoint_context.sdb.do_sub(sid, uid, '')
      return sid