With this package, you can call reorder-python-imports automatically before saving.
Clone this repository somewhere. Then add the following to your emacs config:
(add-to-list 'load-path "~/.config/emacs-packages/reorder-python-imports.el")
(require 'reorder-python-imports)
(add-hook 'python-mode-hook 'reorder-python-imports-mode)
I copied almost all the code from proofit404’s blacken.el, so I am forever in debt to him. Cheers!