moved python algorithms to the Python file