I think this code should go after the ``if (!%(z)s)`` part.