clean code of slave.py