def generate_content(data):
 try:
  return (templates[data['type']][data['event']] % data['values'])
 except KeyError:
  return json_error(_('Unknown message'))

def generate_content ( data ) : try : return ( templates [ data [ 'type' ] ] [ data [ 'event' ] ] % data [ 'values' ] ) except KeyError : return json_error ( _ ( 'Unknown message' ) )
gets the template string and formats it with parsed data .