Count business days between two dates (private), taking holidays into
        consideration.

        Args:
            date1 (date, datetime or str): Date start of interval.
            date2 (date, datetime or str): Date end of interval.

        Note:
            The adopted notation is COB to COB, so effectively date1 is not
            included in the calculation result.

        Example:
            >>> cal = Calendar()
            >>> date1 = datetime.datetime.today()
            >>> date2 = cal.addbusdays(date1, 1)
            >>> cal.busdaycount(date1, date2)
            1

        Returns:
            int: Number of business days between the two dates. If the dates
                are equal the result is zero. If date1 > date2 the result is
                negative.

def busdaycount(self, date1, date2):
        """
        Count business days between two dates (private), taking holidays into
        consideration.

        Args:
            date1 (date, datetime or str): Date start of interval.
            date2 (date, datetime or str): Date end of interval.

        Note:
            The adopted notation is COB to COB, so effectively date1 is not
            included in the calculation result.

        Example:
            >>> cal = Calendar()
            >>> date1 = datetime.datetime.today()
            >>> date2 = cal.addbusdays(date1, 1)
            >>> cal.busdaycount(date1, date2)
            1

        Returns:
            int: Number of business days between the two dates. If the dates
                are equal the result is zero. If date1 > date2 the result is
                negative.
        """
        date1 = parsefun(date1)
        date2 = parsefun(date2)
        if date1 == date2:
            return 0
        elif date1 > date2:
            date1, date2 = date2, date1
            direction = -1
        else:
            direction = 1

        ndays = self._workdaycount(date1, date2)

        if self.holidays:
            holidays = self.holidays # speed up
            if date1 > holidays[-1]:
                warn('Holiday list exhausted at end, ' \
                     'busdaycount(%s,%s) output may be incorrect.' % \
                     (date1, date2))
            elif date2 < holidays[0]:
                warn('Holiday list exhausted at start, ' \
                     'busdaycount(%s,%s) output may be incorrect.' % \
                     (date1, date2))
            else:
                if date1 < holidays[0]:
                    warn('Holiday list exhausted at start, ' \
                         'busdaycount(%s,%s) output may be incorrect.' % \
                         (date1, date2))
                if date2 > holidays[-1]:
                    warn('Holiday list exhausted at end, ' \
                         'busdaycount(%s,%s) output may be incorrect.' % \
                         (date1, date2))
                # i is the index of first holiday > date
                # we don't care if the start date is a holiday
                i = bisect.bisect_right(holidays, date1)
                while holidays[i] <= date2:
                    ndays -= 1
                    i += 1
                    if i == len(holidays):
                        break

        return ndays * direction