def sdnv_encode(value):
    """Returns the SDNV-encoded byte string representing value

    Args:
        value (int): Non-negative integer that should be encoded
    Returns:
        bytes: SDNV-encoded number
    Raises:
        ValueError: If value not an integer or negative
    """
    if value < 0 or not isinstance(value, int):
        raise ValueError("Only non-negative integers can be SDNV-encoded")

    # Special case: zero whould produce an empty byte string
    if value == 0:
        return b"\x00"

    result = bytearray()
    while value != 0:
        result.append((value & 0x7f) | 0x80)
        value >>= 7

    # Clear MSB in the first byte that was set by the XOR with 0x80
    result[0] &= 0x7f

    # Network byte order
    return bytes(reversed(result))