'Find all subexpressions matching a query.'

def find(self, query, group=False):

    query = _make_find_query(query)
    results = list(filter(query, preorder_traversal(self)))
    if (not group):
        return set(results)
    else:
        groups = {}
        for result in results:
            if (result in groups):
                groups[result] += 1
            else:
                groups[result] = 1
        return groups
