def isroutine ( object ) : return ( isbuiltin ( object ) or isfunction ( object ) or ismethod ( object ) or ismethoddescriptor ( object ) )
python detect if function is a method
Return true if the object is any kind of function or method .
def isroutine(object):
    """Return true if the object is any kind of function or method."""
    return (isbuiltin(object)
            or isfunction(object)
            or ismethod(object)
            or ismethoddescriptor(object))