added optional prettifier for str