Replace try/except with callable() to check if a function