python code of dda