'Return the slug or title for a new redirect.
`template` is a Python string template with "old" and "number" tokens
used to create the variant.'

def _attr_for_redirect(self, attr, template):

    def unique_attr():
        'Return    a    variant    of    getattr(self,    attr)    such    that    there    is    no\n                                                Document    of    my    locale    with    string    attribute    `attr`    equal    to    it.\n\n                                                Never    returns    the    original    attr    value.\n\n                                                '
        i = 1
        while True:
            new_value = (template % dict(old=getattr(self, attr), number=i))
            if (not self._collides(attr, new_value)):
                return new_value
            i += 1
    old_attr = ('old_' + attr)
    if hasattr(self, old_attr):
        return getattr(self, old_attr)
    else:
        return unique_attr()
