def atof(conv, string, func=float):
    """Parses a string as a float according to the locale settings."""
    ts = conv['thousands_sep']
    if ts:
        string = string.replace(ts, '')
    dd = conv['decimal_point']
    if dd:
        string = string.replace(dd, '.')
    return func(string)
