function i = device(file)

try
  i = int64(py.os.stat(file).st_dev);
  % int64 first is for Matlab <= R2022a
catch e
  pythonException(e)
  i = [];
end

i = uint64(i);

end