'Check whether a device is already registered or not.'

def is_device_registered(self, device_id):

    with self._devices_to_register_lock:
        if (device_id in self._devices_to_register.keys()):
            return False
    with self._device_being_registered_lock:
        if (device_id == self._device_being_registered):
            return False
    return True
