Created validate_device_id() function