def _filter_results(self, result, anchor):
valid = True<EOL>try:<EOL><INDENT>cat_tag = result.find('<STR_LIT:a>', {'<STR_LIT>': '<STR_LIT>'}).string<EOL>title = anchor.string.lower()<EOL>date_tag = result.find('<STR_LIT:time>').string<EOL><DEDENT>except (AttributeError, TypeError):<EOL><INDENT>return False      <EOL><DEDENT>if cat_tag != "<STR_LIT>":<EOL><INDENT>valid = False<EOL><DEDENT>if not date_in_range(self.date, date_tag, <NUM_LIT:5>):<EOL><INDENT>valid = False<EOL><DEDENT>if self.category == '<STR_LIT>' and '<STR_LIT>' not in title:<EOL><INDENT>valid = False<EOL><DEDENT>elif self.category != '<STR_LIT>' and '<STR_LIT>' in title:<EOL><INDENT>valid = False<EOL><DEDENT>return valid<EOL>
Filter search results by checking category titles and dates