added docstrings
flake8
bug in with statement