Guard device version code from the case where a `lava` test run does not exist, or where there is no `target.device_version` custom attribute.
Guard device version code from the case where a `lava` test run does not exist,
or where there is no `target.device_version` custom attribute.

Also, since nothing in that method was related to the class that contained it,
it was transformed into a module-level standalone function.


OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server