matt's python code