import ipaddress


def ipv4_is_assignable(address: ipaddress.IPv4Interface) -> ipaddress.IPv4Interface:
    """
    This validator check that given IP address is neither broadcast nor network Id.
    These rules apply to netmasks up to /30.

    Args:
        address: ipaddress.IPv4Interface (address with netmask)

    Returns: ipaddress.IPv4Interface

    """
    # Don't validate address if prefix is /31 or /32
    if int(address.with_prefixlen.split("/")[1]) in [31,32]:
        pass
    else:
        assert address.ip not in [
            address.network.network_address,
            address.network.broadcast_address], f"Invalid IPv4 Interface Address: {address}"
    return address