Add check_devices function

Adds a function to check whether devices exist or not.

[skip ci]