write merge.py