def sleep(sec):
    "A blocking function magically converted in a non-blocking one."
    print 'start sleep %s' % sec
    time.sleep(sec)
    print '\nend sleep %s' % sec
    return "ok"
A blocking function magically converted in a non-blocking one.
recipes/Python/439358_Twisted_blocking_functions_deferred/recipe-439358.py