<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _check_classes(self):
 """ check input imdbs, make sure they have same classes """

        try:
            self.classes = self.imdbs[0].classes
            self.num_classes = len(self.classes)
        except AttributeError:
            # fine, if no classes is provided
            pass

        if self.num_classes > 0:
            for db in self.imdbs:
                assert self.classes == db.classes, "Multiple imdb must have same classes"