@app.template_filter()
def title_address(address):
    'Slightly improved title() method for address strings\n    Makes sure state abbreviations are upper-case.'
    titled = address.title()
    titled = state_pattern.sub((lambda match: (match.group(1).upper() + (match.group(2) or ''))), titled)
    return titled
Slightly improved title() method for address strings
Makes sure state abbreviations are upper-case.
@app.template_filter()
def title_address(address):
    'Slightly improved title() method for address strings\n    Makes sure state abbreviations are upper-case.'
    titled = address.title()
    titled = state_pattern.sub((lambda match: (match.group(1).upper() + (match.group(2) or ))), titled)
    return titled