def calc_nlanes(reg_dict):
    """
    Return the number of MIPI Lanes used during readout

    Parameters
    ----------
    reg_dict : dict
        The dictionary that contains all the register information

    Returns
    ----------
    nlanes : int
        The number of lanes, 2 or 4
    """
    if reg_dict["DATA_LANE_CONFIG"][2] == 0:
        return 2
    elif reg_dict["DATA_LANE_CONFIG"][2] == 1:
        return 4
    else:
        raise RuntimeError("Invalid lane configuration!")
    return