Would an checking `isinstance(arg, Function)` work in those cases?