Python code. Still modifications to do