<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _register(self, obj):
 """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 """

        session = None

        while session is None or session in self.sessions:
            session = random.randint(1000000, 9999999)

        self.sessions[session] = obj
        return session