Calibre prior to 5.00 is working with python 2, after version 5.00 it's python 3, that's why it doesn't works. If you upgrade Calibre, it will work. There is plenty of new features, you should do it.
If you want to keep your old version try this code:
Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
start_at = 80
n = int(match.group(1))
if n >= start_at:
return str(n+1) + match.group(2)
return match.group(0)