def _select_win_size(max_ref_len, select_win, win):
    """
    Set smoothing window size
    :param max_ref_len: length of reference
    :param select_win: True if window size to be selected
    :param win: window size
    :return: window size, bool whther to select win
    """
    if win == 0 or select_win:
        win = int(max_ref_len / 30)
        select_win = True
    if win % 2 != 0:
        win += 1
    if win < 6:
        win = 1
    return win, select_win