def query_prefix_transform(query_term):
    """str -> (str, bool)
    return (query-term, is-prefix) tuple
    """
    is_prefix = query_term.endswith('*')
    query_term = query_term[:-1] if is_prefix else query_term
    return (query_term, is_prefix)