def scrub_relative_urls(html):
	try:
		return re.sub("""src[\s]*=[\s]*['"]files/([^'"]*)['"]""", 'src="/files/\g<1>"', html)
		# return re.sub("""(src|href)[^\w'"]*['"](?!http|ftp|mailto|/|#|%|{|cid:|\.com/www\.)([^'" >]+)['"]""", '\g<1>="/\g<2>"', html)
	except:
		print "Error", html
		raise
prepend a slash before a relative url
dataset/ETHPy150Open frappe/frappe/frappe/patches/v5_0/fix_text_editor_file_urls.py/scrub_relative_urls