Add strip_whitespace helper

Useful e.g. for wtforms filters