code: def check_validity(self):
          Raise error if any invalid attribute found."""
          # pianoroll
          if not isinstance(self.pianoroll, np.ndarray):
              raise TypeError("`pianoroll` must be a numpy array.")
          if not (np.issubdtype(self.pianoroll.dtype, np.bool_)
                  or np.issubdtype(self.pianoroll.dtype, np.number)):
              raise TypeError("The data type of `pianoroll` must be np.bool_ or "
                              "a subdtype of np.number.")
          if self.pianoroll.ndim != 2:
              raise ValueError("`pianoroll` must have exactly two dimensions.")
          if self.pianoroll.shape[1] != 128:
              raise ValueError("The length of the second axis of `pianoroll` "
                               "must be 128.")
          # program
          if not isinstance(self.program, int):
              raise TypeError("`program` must be int.")
          if self.program < 0 or self.program > 127:
              raise ValueError("`program` must be in between 0 to 127.")
          # is_drum
          if not isinstance(self.is_drum, bool):
              raise TypeError("`is_drum` must be bool.")
          # name
          if not isinstance(self.name, string_types):
              raise TypeError("`name` must be a string.")
docs: Raise error if any invalid attribute found.