[python] How do I detect whether a Python variable is a function?