<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def resolve_child_module_registries_lineage(registry):
 """ For a given child module registry, attempt to resolve the lineage. Return an iterator, yielding from parent down to the input registry, inclusive of the input registry. """


    children = [registry]
    while isinstance(registry, BaseChildModuleRegistry):
        if registry.parent in children:
            # this should never normally occur under normal usage where
            # classes have been properly subclassed with methods defined
            # to specificiation and with standard entry point usage, but
            # non-standard definitions/usage can definitely trigger this
            # self-referential loop.
            raise TypeError(
                "registry '%s' was already recorded in the lineage, "
                "indicating that it may be some (grand)child of itself, which "
                "is an illegal reference in the registry system; previously "
                "resolved lineage is: %r" % (registry.parent.registry_name, [
                    r.registry_name for r in reversed(children)
                ])
            )

        pl = len(registry.parent.registry_name)
        if len(registry.parent.registry_name) > len(registry.registry_name):
            logger.warning(
                "the parent registry '%s' somehow has a longer name than its "
                "child registry '%s'; the underlying registry class may be "
                "constructed in an invalid manner",
                registry.parent.registry_name,
                registry.registry_name,
            )
        elif registry.registry_name[:pl] != registry.parent.registry_name:
            logger.warning(
                "child registry '%s' does not share the same common prefix as "
                "its parent registry '%s'; there may be errors with how the "
                "related registries are set up or constructed",
                registry.registry_name,
                registry.parent.registry_name,
            )
        children.append(registry.parent)
        registry = registry.parent
    # the lineage down from parent to child.
    return iter(reversed(children))