'Change \':\'\' and \'-\' to \'_\' to ensure valid template variable names'

def fix_invalid_varnames(self, data):

    new_data = data.copy()
    for (key, value) in data.items():
        if ((':' in key) or ('-' in key)):
            newkey = re.sub(':|-', '_', key)
            new_data[newkey] = value
            del new_data[key]
    return new_data
