collected reusable methods in ditto.py