def trunc_if_integer(n: Any) -> Any:
    """
    Truncates floats that are integers to their integer representation.
    That is, converts ``1.0`` to ``1``, etc.
    Otherwise, returns the starting value.
    Will raise an exception if the input cannot be converted to ``int``.
    """
    if n == int(n):
        return int(n)
    return n
Truncates floats that are integers to their integer representation.
    That is, converts ``1.0`` to ``1``, etc.
    Otherwise, returns the starting value.
    Will raise an exception if the input cannot be converted to ``int``.