If you work with strings in your Python scripts and you're writing obscure logic to process them, then you need to look into regex in Python. It lets you describe patterns instead of writing ...
That means, any string will be boiled down to these characters, outlined in EPC217-08 Draft Best Practices SEPA Requirements for Character Set v1.1.pdf: a b c d e f g ...