Implementing simple boolean retrieval search using Python