Regarding the as_names parameter here, a couple things I've learned over time and by reading about this sort of thing in my spare time are that

(a) YAGNI (You Aren't Gonna Need It): don't add features until they're actually needed.  Nothing currently calls this function with as_names=True, so currently all having this parameter does is make the function a little more complicated.  And when you add features that aren't used and someone else tries to use them later, they might not do what they were supposed to do because no one was actually using them before.  If you're definitely going to add something that does call it with as_names=True, then disregard this.

(b) it's better to separate something like this into two different methods with clearly-defined return types and abstract the common logic into a helper function instead of having one giant function that takes in all sorts of parameters.