Output to original stdout and displaypub inside an Output widget

Hi there, I’m wondering if it’s possible to output contents to original stdout and displaypub inside an Output widget. For example

from ipywidgets import Output

output_widget = Output()
with output_widget:
    the_function_i_need("This should be sent to original stdout, and shown up outside the output_widget.")
    print("This is going to be captured by output_widget.")