Clean up some PEP8 and unused variables

Yes, I was very careful to make sure the unused variables were
*actually* unused.
Rewrite sed to not check the 'after' pattern; Fixes #4353

Sed is a stream editor.  It doesn't have the ability to tell whether an
edit has already been made -- it just makes edits.  Thus, we no longer
check if the 'after' pattern is present.  If the 'before' pattern is
present, we run the sed command and return True.  If the 'before'
pattern is not present, we say so and return True (because it probably
just means sed has been run already in a previous state.highstate).

This makes it so backreferences now work without returning False on
subsequent runs.