def istask(x):
 return ((type(x) is tuple) and x and callable(x[0]))

def istask ( x ) : return ( ( type ( x ) is tuple ) and x and callable ( x [ 0 ] ) )
is x a runnable task? a task is a tuple with a callable first argument examples .