*cough* eadred. http://django-eadred.readthedocs.org/en/latest/api.html#eadred.helpers.sentence_generator

Also, I wouldn't use xrange unless you're fiddling with large things. Amongst other things, xrange doesn't exist in Python 3. http://docs.python.org/2/library/functions.html#xrange