Using python fcntl test from Dennis Kaarsemaker