I suggest putting `old_url = False` above the `for` loop line, so you don't have to check whether a variable has been defined yet, and can just do `if old_url:`.