def _populate_profile_flags_from_dn_regex(self, profile):
save_profile = True<EOL>for field, regex in self.settings.PROFILE_FLAGS_BY_DN_REGEX.items():<EOL><INDENT>field_value = False<EOL>if re.search(regex, self._get_user_dn(), re.IGNORECASE):<EOL><INDENT>field_value = True<EOL><DEDENT>setattr(profile, field, field_value)<EOL>save_profile = True<EOL><DEDENT>return save_profile<EOL>
Populate the given profile object flags from AUTH_LDAP_PROFILE_FLAGS_BY_DN_REGEX.
Returns True if the profile was modified