What if you didn't get a match and match is None? I also don't see where 'u' was introduced into the match (which should only have a, b and c). Maybe I am missing it in the limited amount I can see.