pub fn parse_device_string(device_str: &str) -> PyResult<DeviceType>
Convert device string to DeviceType