code: def set_flag(self, value, flag, reset_val=False):
          
          if not self.__dict__[flag]:
              self.__dict__[flag] = matrix(1.0, (len(self.__dict__[value]), 1),
                                           'd')
          for idx, item in enumerate(self.__dict__[value]):
              if item == 0:
                  self.__dict__[flag][idx] = 0
                  if reset_val:
                      self.__dict__[value][idx] = 1
docs: Set a flag to 0 if the corresponding value is 0