As of Python 3.6, a backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning. Although this will eventually become a SyntaxError, that will not be for several Python releases.

Anti-pattern

regex = r'\.png$'

Best practice

regex = '\.png$'