def _filter_by_m2m_schema(self, qs, lookup, sublookup, value, schema, model=None):
model = model or self.model<EOL>schemata = dict((s.name, s) for s in model.get_schemata_for_model())   <EOL>try:<EOL><INDENT>schema = schemata[lookup]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise ValueError(u'<STR_LIT>' % lookup)<EOL><DEDENT>sublookup = '<STR_LIT>'%sublookup if sublookup else '<STR_LIT>'<EOL>return {<EOL>'<STR_LIT>': schema,<EOL>'<STR_LIT>'%sublookup: value,  <EOL>}<EOL>
Filters given entity queryset by an attribute which is linked to given
many-to-many schema.