def dictsortreversed(value, arg):
 decorated = [(resolve_variable(('var.' + arg), {'var': item}), item) for item in value]
 decorated.sort()
 decorated.reverse()
 return [item[1] for item in decorated]

def dictsortreversed ( value , arg ) : decorated = [ ( resolve_variable ( ( 'var.' + arg ) , { 'var' : item } ) , item ) for item in value ] decorated . sort ( ) decorated . reverse ( ) return [ item [ 1 ] for item in decorated ]
takes a list of dicts .