I made a somewhat related program called pyxargs[1] which may help with what you're looking for. The command for your example would be
pyxargs --py "print('{}') if os.path.ismount('{}') else ''" | pyxargs -m stdin fusermount -u {}
[1] https://github.com/elesiuta/pyxargs