def _check_values(self, value):
key = self.to_field_name or '<STR_LIT>'<EOL>try:<EOL><INDENT>value = frozenset(value)<EOL><DEDENT>except TypeError:<EOL><INDENT>raise ValidationError(<EOL>self.error_messages['<STR_LIT:list>'],<EOL>code='<STR_LIT:list>',<EOL>)<EOL><DEDENT>for pk in value:<EOL><INDENT>try:<EOL><INDENT>self.queryset.filter(**{key: pk})<EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>raise ValidationError(<EOL>self.error_messages['<STR_LIT>'],<EOL>code='<STR_LIT>',<EOL>params={'<STR_LIT>': pk},<EOL>)<EOL><DEDENT><DEDENT>qs = EventOccurrence.objects.filter(**{'<STR_LIT>' % key: value})<EOL>pks = set(force_text(getattr(o, key)) for o in qs)<EOL>for val in value:<EOL><INDENT>if force_text(val) not in pks:<EOL><INDENT>raise ValidationError(<EOL>self.error_messages['<STR_LIT>'],<EOL>code='<STR_LIT>',<EOL>params={'<STR_LIT:value>': val},<EOL>)<EOL><DEDENT><DEDENT>return qs<EOL>
Given a list of possible PK values, returns a QuerySet of the
corresponding objects. Raises a ValidationError if a given value is
invalid (not a valid PK, not in the queryset, etc.)