def is_function(obj):
    'Returns true if passed a function\n\n    >>> is_function(lambda x: 1)\n    True\n\n    >>> is_function(locals)\n    True\n\n    >>> def method(): pass\n    >>> is_function(method)\n    True\n\n    >>> is_function(1)\n    False\n    '
    function_types = {types.FunctionType, types.MethodType, types.LambdaType, types.BuiltinFunctionType, types.BuiltinMethodType}
    return (type(obj) in function_types)
Returns true if passed a function

>>> is_function(lambda x: 1)
True

>>> is_function(locals)
True

>>> def method(): pass
>>> is_function(method)
True

>>> is_function(1)
False
def is_function(obj):
    'Returns true if passed a function\n\n    >>> is_function(lambda x: 1)\n    True\n\n    >>> is_function(locals)\n    True\n\n    >>> def method(): pass\n    >>> is_function(method)\n    True\n\n    >>> is_function(1)\n    False\n    '
    function_types = {types.FunctionType, types.MethodType, types.LambdaType, types.BuiltinFunctionType, types.BuiltinMethodType}
    return (type(obj) in function_types)