def do_dict_entry_for_item(parser, token):
 bits = token.contents.split()
 if (len(bits) != 6):
  raise template.TemplateSyntaxError(("'%s' tag takes exactly five arguments" % bits[0]))
 if (bits[2] != 'from'):
  raise template.TemplateSyntaxError(("second argument to '%s' tag must be 'from'" % bits[0]))
 if (bits[4] != 'as'):
  raise template.TemplateSyntaxError(("fourth argument to '%s' tag must be 'as'" % bits[0]))
 return DictEntryForItemNode(bits[1], bits[3], bits[5])

def do_dict_entry_for_item ( parser , token ) : bits = token . contents . split ( ) if ( len ( bits ) != 6 ) : raise template . TemplateSyntaxError ( ( "'%s' tag takes exactly five arguments" % bits [ 0 ] ) ) if ( bits [ 2 ] != 'from' ) : raise template . TemplateSyntaxError ( ( "second argument to '%s' tag must be 'from'" % bits [ 0 ] ) ) if ( bits [ 4 ] != 'as' ) : raise template . TemplateSyntaxError ( ( "fourth argument to '%s' tag must be 'as'" % bits [ 0 ] ) ) return DictEntryForItemNode ( bits [ 1 ] , bits [ 3 ] , bits [ 5 ] )
given an object and a dictionary keyed with object ids - as returned by the votes_by_user and scores_for_objects template tags - retrieves the value for the given object and stores it in a context variable .