Refactor C++ and Python code to comply to formatting guide

To achieve a consistent visual style in the code, it should adhere to style definitions.

For Python, we use PEP 8 with very slight adjustments. This is best achieved by using the black formatter in its default settings.

For C++, we use clang-format with a style the only deviates slightly from the Mozilla preset. The .clang-format settings are the following:

---
BasedOnStyle: Mozilla

# Break before braces, except for one-line statements
BreakBeforeBraces: Allman

# Do not break before assignment operators
BreakBeforeBinaryOperators: NonAssignment

The code should include this file in the top-level directory and be re-formatted accordingly.