def to_float(value):
    """
    Convert given value to float if possible.

    :param value: input value
    :type value: mixed
    :return: float value
    :rtype: float
    """

    try:
        return float(value)
    except ValueError:
        assert False, 'value %s cannot be converted to float' % str(value)