The runtime of get_submodule is bounded by the degreeof module nesting in target. A query againstnamed_modules achieves the same result, but it is O(N) inthe number of transitive modules. So, for a simple check to seeif some submodule exists, get_submodule should always beused.