[1.7.x] Fixed #22998 -- Updated the fast_delete logic for GFKs

Backport of 6e2b82fdf6 from master
[1.7.x] PEP8 cleanup

Backport of f8df55050c from master