<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def index_normalize(index_val):
 """Normalize dictionary calculated key When parsing, keys within a dictionary may come from the input text. To ensure there is no space or other special caracters, one should use this function. This is useful because DictExt dictionaries can be access with a dotted notation that only supports ``A-Za-z0-9_`` chars. Args: index_val (str):
 The candidate string to a dictionary key. Returns: str: A normalized string with only ``A-Za-z0-9_`` chars Examples: 'this_my_key' 'this_my_key' """

    index_val = index_val.lower().strip()
    index_val = re.sub(r'^\W*','',index_val)
    index_val = re.sub(r'\W*$','',index_val)
    index_val = re.sub(r'\W+','_',index_val)
    index_val = re.sub('_+','_',index_val)
    return index_val