extract lots of common webmention handling code out of publish.py into webmention.py