import gevent

def foo():
    print('Running in foo')
    gevent.sleep(1)
    print('Explicit context switch to foo again')
    gevent.sleep(1)

def bar():
    print('Explicit context to bar')
    gevent.sleep(1)
    print('Implicit context switch back to bar')
    gevent.sleep(1)

gevent.joinall([
    gevent.spawn(foo),
    gevent.spawn(bar),
])