Update detach.py

-Prune unnecessary code (thanks TingPing)