Created validate_device_id() function

You can use this to check that a device id is valid.