Use hasattr per recommendation in docs for dl.
Define if_dl using simple lambda.
Extract variables for clarity and simpler indentation.
Extract variable for simplicity of indentation.
Rewrite short-circuit for/if/else loop as any on generator expression.
Extract filtering of extensions that need stubs.
Reindent
Rewrite function to use extend and a generator expression.
Extract method for clarity.
Use itertools.product to pair each base with each extension.
Collapse two generator expressions.
Extract logic for getting the extensions for outputs.
Add comments for clarity.
Force list type for easy concatenation.