Redshift Trim Function In Python Definition