from typing import Union
from typing import Tuple
from typing import List


def fields_to_device_number(fields: Union[Tuple[int, int], List[int]]) -> int:
    """
    Joins the two 8 bit fields into a 16 bit device number

    Example with fields 3 and 232
    3:      0b00000011
    232:    0b11101000
    1000:   (3 << 8) | 232
            (3 << 8) == 0b1100000000
            0b1100000000 | 232 == 1000
    """
    # return struct.unpack('<H', bytes(fields))[0]
    return (fields[1] << 8) | fields[0]