Fix custom init sorting script
# What does this PR do?

The custom init sort script was failing when there is a comment between the test for a framework and the imports (see the diff in the main init). This PR fixes that.
_The documentation is not available anymore as the PR was closed or merged._