Python captura la salida de impresión de otro módulo

Me preguntaba si esto es posible en Python.

#module1
def test():
    print 'hey'

#module2
import module1

# *Without modifying module1* is there anyway to wrap this in module2 so that I can capture the
# print 'hey' inside a variable? apart from running module1 as a script?
module1.test() # prints to stdout

¡Gracias!

Respuestas a la pregunta(3)

Su respuesta a la pregunta