code: def _register(self, obj):
          
          session = None
  
          while session is None or session in self.sessions:
              session = random.randint(1000000, 9999999)
  
          self.sessions[session] = obj
          return session
docs: Creates a random but unique session handle for a session object,
          register it in the sessions dictionary and return the value
  
          :param obj: a session object.
          :return: session handle
          :rtype: int