def validate_float(s):
    """Convert s to float or raise a ValueError."""
    try:
        return float(s)
    except ValueError:
        raise ValueError('Could not convert {0!r} to float'.format(s))