INTERPOLATION_RE = re.compile('\\$\\{(?:(?P<section>[^:]+):)?(?P<key>[^}]+)\\}'
    )

def load_something_from_cp(cp, section='section'):
    result = []

def interpolate_func(match):
    d = match.groupdict()
section = d.get('section', section)
key = d.get('key')
return cp.get(section, key)
for k, v in cp.items(section):
    v = re.sub(INTERPOLATION_RE, interpolate_func, v)
result.append((v, k))
return result
Интерполяция Python ConfigParser из иностранного раздела