code: def validate(self):
          
          assert self.path, "{} must have a path".format(self.__class__.__name__)
          _, dotext = os.path.splitext(self.path)
          ext = dotext.lstrip('.')
          # don't validate for single-digit extension, or no extension
          if len(ext) > 1:
              assert ext in self.allowed_formats, "{} must have one of the following"
              "extensions: {} (instead, got '{}' from '{}')".format(
              self.__class__.__name__, self.allowed_formats, ext, self.path)
docs: Ensure `self.path` has one of the extensions in `self.allowed_formats`.