def check_user_settings(self, medium='<STR_LIT:email>'):
<EOL>if self.type == '<STR_LIT>':<EOL><INDENT>return True<EOL><DEDENT>try:<EOL><INDENT>user_settings = getattr(self.to_user, '<STR_LIT>' % medium)<EOL><DEDENT>except ObjectDoesNotExist:<EOL><INDENT>return False<EOL><DEDENT>user_setting_type = getattr(user_settings.__class__, self.type).user_setting_type<EOL>if user_setting_type == '<STR_LIT>':<EOL><INDENT>return getattr(user_settings, self.type, True)<EOL><DEDENT>elif user_setting_type == '<STR_LIT>':<EOL><INDENT>value = getattr(user_settings, self.type, <NUM_LIT:0>)<EOL>if value is <NUM_LIT:0>:<EOL><INDENT>return True<EOL><DEDENT>elif value < <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>Model = self.related_object.__class__<EOL>geo_field = getattr(user_settings.__class__, self.type).geo_field<EOL>geo_value = getattr(self.related_object, geo_field)<EOL>km = value * <NUM_LIT:1000><EOL>queryset = Model.objects.filter(**{<EOL>"<STR_LIT>": self.to_user_id,<EOL>geo_field + "<STR_LIT>": (geo_value, km)<EOL>})<EOL>return queryset.count() >= <NUM_LIT:1><EOL><DEDENT><DEDENT>
Ensure user is ok with receiving this notification through the specified medium.
Available mediums are 'web' and 'email', while 'mobile' notifications will
hopefully be implemented in the future.