def _get_firstbday(wkday):
    first = 1
    if wkday == 5:  # on Saturday
        first = 3
    elif wkday == 6:  # on Sunday
        first = 2
    return first
wkday is the result of monthrange(year, month)
dataset/ETHPy150Open pydata/pandas/pandas/tseries/offsets.py/_get_firstbday