This is an analog to https://github.com/django/django/blob/master/django/contrib/admin/validation.py#L230.