Replace print statements in documentation with functions