[Python-ideas] adding a trim convenience function