As of Python 3.6, a backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning. This will eventually become a SyntaxError.

Anti-pattern

regex = '\.png$'

Best practice

regex = r'\.png$'