How to handle escaped braces in Python format string regex matching?