Printer function in Python