more robust set_media_domains script
Merge pull request #2840 from dimagi/mm

more robust set_media_domains script