Honestly I'm not a fan of this code... this works, but IMO it would be more "technically correct" if there was simply no regex line here at all when DEBUG = True.

So, I would either concatenate this onto a new tuple or use a list and append(probably best). It just feels icky to have a regex being evaluated when what you actually want is nothing at all.