def METHOD_NAME(dio_mode: str, channels: List[int]) -> Tuple[int, int]:
    # extract information for dio_mode from _control_modes
    control_mode = _control_modes.get(dio_mode)
    if control_mode is None:
        raise ValueError(f"Unsupported DIO mode '{dio_mode}'")
    control_bits = control_mode['control_bits']
    # FIXME: also return trigger_bits
    # trigger_bits = control_mode['trigger_bits']
    # calculate mask
    nr_channels = 8  # fixed assumption for HDAWG and dual-QWG combo
    nr_groups = len(control_bits)
    ch_per_group = nr_channels/nr_groups
    mask = 0
    shift = sys.maxsize
    for ch in channels:
        if ch<0 or ch >= nr_channels:
            raise ValueError(f"Illegal channel {ch}")
        group = int(ch // ch_per_group)
        for bit in control_bits[group]:
            mask = mask | (1 << bit)
            if bit<shift:
                shift = bit  # find lowest bit used
    return shift,mask>>shift