def get_number_from_string(s, number_type, default):
    """Returns a numeric value of number_type created from the given string or default if the cast is not possible."""
    try:
        return number_type(s.replace(",", "."))
    except ValueError:
        return default