def fint(value):
    """integer"""
    if isinstance(value, str_types):
        # strings might have been saved wrongly as booleans
        value = value.lower()
        if value == "false":
            value = 0
        elif value == "true":
            value = 1
        elif value:
            value = int(float(value))
        else:
            raise ValueError("empty string")
    else:
        value = int(float(value))
    return value