Add a generic function to get a list of terms with some prefix.