flake8 fixes

Signed-off-by: Kwpolska <kwpolska@gmail.com>
Replace {} with {n}

Signed-off-by: Kwpolska <kwpolska@gmail.com>
Exceptions implemented, needs testing

Signed-off-by: Kwpolska <kwpolska@gmail.com>