In python when you print, you're really just calling sys.stdout's write() method.  Its easy to make your own custom class that gets written to
import sys
class MyClass(object):
    def write(self, astring):
        # do stuff
sys.stdout = MyClass()
What, if any, specifications are there for the write() method?  This question seems to indicate that it just needs to take a string input.  Are there any other rules or specifications as to what the method should accept and do?
 
    