def tag_match(self, tags=None):
        """List all samples that match the tags or all if tags are not specified.

        Args:
            tags: Match samples against these tags (or all if not specified)

        Returns:
            List of the md5s for the matching samples
        """
        if self.database.collection_names() not in 'tags':
            print 'Warning: Searching on non-existance tags collection'
            return None
        if not tags:
            cursor = self.database['tags'].find({}, {'_id':0, 'md5':1})
        else:
            cursor = self.database['tags'].find({'tags': {'$in': tags}}, {'_id':0, 'md5':1})

        # We have the tags, now make sure we only return those md5 which 
        # also exist in the samples collection
        tag_md5s = set([item['md5'] for item in cursor])
        sample_md5s = set(item['md5'] for item in self.database['samples'].find({}, {'_id':0, 'md5':1}))
        return list(tag_md5s.intersection(sample_md5s))
dataset/ETHPy150Open SuperCowPowers/workbench/workbench/server/data_store.py/DataStore.tag_match/swapped operands of `not in`