def _filter_by_range_schema(self, qs, lookup, sublookup, value, schema):
<EOL>sublookup = sublookup or RANGE_INTERSECTION_LOOKUP<EOL>if not sublookup == RANGE_INTERSECTION_LOOKUP:<EOL><INDENT>raise ValueError('<STR_LIT>' %<EOL>RANGE_INTERSECTION_LOOKUP)<EOL><DEDENT>try:<EOL><INDENT>_, _ = value<EOL><DEDENT>except ValueError:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>except TypeError:<EOL><INDENT>raise TypeError('<STR_LIT>' % value)<EOL><DEDENT>value_lookups = zip((<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>), value)<EOL>conditions = dict((k,v) for k,v in value_lookups if v is not None)<EOL>conditions.update({<EOL>'<STR_LIT>': schema,<EOL>})<EOL>return conditions<EOL>
Filters given entity queryset by an attribute which is linked to given
range schema. Lookups `between` yields items that lie not completely
within given range but have intersection with it. For example, and item
with x=(2,5) will match q=(3,None) or q=(0,3). See tests for details.

    qs.filter(weight_range__overlaps=(1,3))
    qs.filter(weight_range__overlaps=(1,None))