code: def add_validator(self, val_template):
          
          validator = val_template.validator
          
          args = []
          for arg in SymbolValidity.argnames:
              if arg in val_template.__dict__.keys():
                  args.append(getattr(val_template, arg))
  
          objs = object_session(self)
          qry = objs.query(func.max(SymbolValidity.vid).label('max_vid'))
          qry = qry.filter_by(symname = self.name)
          
          cur_vid = qry.one()[0]
          
          if cur_vid is None:
              next_vid = 0
          else:
              next_vid = cur_vid + 1   
              
         
          self.validity.append(SymbolValidity(self, next_vid, validator, *args))
          objs.commit()
docs: Creates and adds a SymbolValidity object to the Symbol.
  
          Parameters
          ----------
          validity_template : bValidity or bValidity-like
              a validity template.