<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_keepalive(self, cmd, callback):
 """Register custom keepalive IPMI command This is mostly intended for use by the console code. calling code would have an easier time just scheduling in their own threading scheme. Such a behavior would naturally cause the default keepalive to not occur anyway if the calling code is at least as aggressive about timing as pyghmi :param cmd: A dict of arguments to be passed into raw_command :param callback: A function to be called with results of the keepalive :returns: value to identify registration for unregister_keepalive """

        regid = random.random()
        if self._customkeepalives is None:
            self._customkeepalives = {regid: (cmd, callback)}
        else:
            while regid in self._customkeepalives:
                regid = random.random()
            self._customkeepalives[regid] = (cmd, callback)
        return regid