code: def adjust(self, date, mode):
          
          date = parsefun(date)
          if self.isbusday(date):
              return date
  
          if mode == FOLLOWING:
              dateadj = self.addbusdays(date, 1)
          elif mode == PREVIOUS:
              dateadj = self.addbusdays(date, -1)
          elif mode == MODIFIEDFOLLOWING:
              dateadj = self.addbusdays(date, 1)
              if dateadj.month != date.month:
                  dateadj = self.addbusdays(dateadj, -1)
          else:
              raise ValueError('Invalid mode %s' % mode)
  
          return dateadj
docs: Adjust the date to the closest work date.
  
          Args:
              date (date, datetime or str): Date to be adjusted.
              mode (integer): FOLLOWING, PREVIOUS or MODIFIEDFOLLOWING.
  
          Note:
              If date is already a business date than it is returned unchanged.
              How to use the adjustment constants:
  
              **FOLLOWING**:
                  Adjust to the next business date.
              **PREVIOUS**:
                  Adjust to the previous business date.
              **MODIFIEDFOLLOWING**:
                  Adjust to the next business date unless it falls on a
                  different month, in which case adjust to the previous business
                  date.
  
          Returns:
              datetime: Adjusted date.