Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def validate(self, data, session=None, *args, **kwargs):
self.session = session or self.session
if not self.session:
raise ValueError('Validation requires a session')
return super(ModelSchema, self).validate(data, *args, **kwargs)