import re


def normalize_simapro_formulae(formula, settings):
    """Convert SimaPro formulae to Python"""
    def replace_comma(match):
        return match.group(0).replace(",", ".")

    formula = formula.replace("^", "**")
    if settings and settings.get('Decimal separator') == ',':
        formula = re.sub('\d,\d', replace_comma, formula)
    return formula