1# Use types.FunctionType
2>>> import types
3>>> types.FunctionType
4<class 'function'>
5
6>>> def f(): pass
7
8>>> isinstance(f, types.FunctionType)
9True
10>>> isinstance(lambda x : None, types.FunctionType)
11True
12
1try: x
2except NameError: some_fallback_operation( )
3else: some_operation(x)