Improve code flow of _generate_metadata_legacy
Improve code flow of _generate_metadata_legacy

Because it was a little difficult to follow.
Because the comments weren't helpful unless you've built enough context.

xavfernandez/pip,sbidoul/pip,pradyunsg/pip,rouge8/pip,pypa/pip,rouge8/pip,pfmoore/pip,xavfernandez/pip,xavfernandez/pip,rouge8/pip,pradyunsg/pip,pfmoore/pip,sbidoul/pip,pypa/pip