The problem is probably with these lines for bootstrap3 and these for bootstrap4 since subject_location ends up being either None or bool and not being None or str (subject location data) as intended. The solution might be something like this:
if hasattr(instance.image, 'subject_location') and 'subject_location' in resize_options:
subject_location = instance.image.subject_location
else:
subject_location = None
The problem is probably with these lines for bootstrap3 and these for bootstrap4 since
subject_location
ends up being eitherNone
orbool
and not beingNone
orstr
(subject location data) as intended. The solution might be something like this: