(buf)
Convert to network order.

    :param buf: Bytes to convert
    :type buf: bytearray
    :returns: int
Convert to network order.
Convert to network order .
def ntoh(buf):
    """Convert to network order.

    :param buf: Bytes to convert
    :type buf: bytearray
    :returns: int
    """
    if len(buf) == 1:
        return buf[0]
    elif len(buf) == 2:
        return struct.unpack('!H', buf)[0]
    elif len(buf) == 4:
        return struct.unpack('!I', buf)[0]
    else:
        raise ValueError('Invalid input buffer size for NTOH')
def ntoh ( buf ) : if len ( buf ) == 1 : return buf [ 0 ] elif len ( buf ) == 2 : return struct . unpack ( '!H' , buf ) [ 0 ] elif len ( buf ) == 4 : return struct . unpack ( '!I' , buf ) [ 0 ] else : raise ValueError ( 'Invalid input buffer size for NTOH' )