def get_rating_for_user(self, user, ip_address=None, cookies={}):
kwargs = dict(<EOL>content_type    = self.get_content_type(),<EOL>object_id       = self.instance.pk,<EOL>key             = self.field.key,<EOL>)<EOL>if not (user and user.is_authenticated()):<EOL><INDENT>if not ip_address:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>kwargs['<STR_LIT>'] = True<EOL>kwargs['<STR_LIT>'] = ip_address<EOL><DEDENT>else:<EOL><INDENT>kwargs['<STR_LIT:user>'] = user<EOL><DEDENT>use_cookies = (self.field.allow_anonymous and self.field.use_cookies)<EOL>if use_cookies:<EOL><INDENT>cookie_name = '<STR_LIT>' % (kwargs['<STR_LIT>'].pk, kwargs['<STR_LIT>'], kwargs['<STR_LIT:key>'][:<NUM_LIT:6>],) <EOL>cookie = cookies.get(cookie_name)<EOL>if cookie:    <EOL><INDENT>kwargs['<STR_LIT>'] = cookie<EOL><DEDENT>else:<EOL><INDENT>kwargs['<STR_LIT>'] = True<EOL><DEDENT><DEDENT>try:<EOL><INDENT>rating = Vote.objects.get(**kwargs)<EOL>return rating.score<EOL><DEDENT>except Vote.MultipleObjectsReturned:<EOL><INDENT>pass<EOL><DEDENT>except Vote.DoesNotExist:<EOL><INDENT>pass<EOL><DEDENT>return<EOL>
get_rating_for_user(user, ip_address=None, cookie=None)

        Returns the rating for a user or anonymous IP.