def update_variables(old_contents):
 new_contents = []
 for line in old_contents:
  words = line.split()
  for word in words:
   if word.endswith(':'):
    word = word[:(-1)]
   if (word in VAR_MAPPINGS.keys()):
    line = line.replace(word, VAR_MAPPINGS[word])
  new_contents.append(line)
 return new_contents

def update_variables ( old_contents ) : new_contents = [ ] for line in old_contents : words = line . split ( ) for word in words : if word . endswith ( ':' ) : word = word [ : ( - 1 ) ] if ( word in VAR_MAPPINGS . keys ( ) ) : line = line . replace ( word , VAR_MAPPINGS [ word ] ) new_contents . append ( line ) return new_contents
replace all references to old variables .