That assumes that there is already a Chapter x. prefix. If you want to handle both the case where there is a prefix and one where there is not, use this:
Code:
import re
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
section_number = '%d. ' % number
return match.group(1) + 'Chapter ' + section_number + re.sub(r'^Chapter \d+\. ', '', match.group(2))