finished D.py