One issue with the way this method is written is that it doesn't actually return the TSUIDs that exist, only what *would* exist if the time series was used. It also may return partial TSUIDs, e.g. if the time series we want has 5 tags but the user only supplies 1 or 2. 
Instead what we'd rather do is scan the 'tsdb-meta' table for 'ts_counter' columns that have been tagged when a new data point was written. This way we have a list of TSUIDs that were actually used to store data and we can craft a query that says "give me all tsuids for metric X". I actually needed such a query for the "last data point" stuff so I'll clean it up and post it this evening then you can work off that.