Add pre-commit hook
pre-commit (https://pre-commit.com) is a tool that makes managing git hooks easy. It's configured here to run black to automatically format Python code and flake8.
pre-commit is run on all files during the first gitlab-ci stage.
It currently fails as there are flake8 error to fix.