writes a print function