def liberty_int(f):
    """

    >>> liberty_int(1.0)
    1
    >>> liberty_int(1.5)
    Traceback (most recent call last):
        ...
    ValueError: 1.5 is not an int

    >>> liberty_int("error")
    Traceback (most recent call last):
        ...
    ValueError: 'error' is not an int

    """
    try:
        f2 = int(f)
    except ValueError as e:
        f2 = None

    if f2 is None or f2 != f:
        raise ValueError("%r is not an int" % f)
    return int(f)