I do not know of a way to take a function outside of another unknown function. If you know what the function “D” is, though, just replace it with the formula inside that function, and simplify.
The problem is that, if you do not know what the function D looks like, you do not know how it is...