def _get_replacements(tokens, data, sec):
    """Helper function for _read_config. """
    replacements = list()
    for token in tokens:
        if ':' in token:
            tsec, tkey = token.split(':')
            tval = ''
            if tsec in data:
                if tkey in data[tsec]:
                    tval = data[tsec][tkey]
        elif token in data[sec]:
            tval = data[sec][token]
        else:
            tval = ''
        replacements.append(('${%s}' % token, tval))
    return replacements
