Proper way to declare custom exceptions in modern Python?

Django many to many relationship with join table-specific fields