@_uses_db<EOL><INDENT>def modify_domain(self, domain_name, new_salt=False, username=None):<DEDENT>
domain = self._get_domain_from_db(domain_name)<EOL>if domain is None:<EOL><INDENT>raise NoSuchDomainException<EOL><DEDENT>if new_salt:<EOL><INDENT>_logger.info("<STR_LIT>")<EOL>domain.new_salt()<EOL><DEDENT>if username is not None:<EOL><INDENT>domain.username = username<EOL><DEDENT>return domain<EOL>
Modify an existing domain.

        :param domain_name: The name of the domain to modify.
        :param new_salt: Whether to generate a new salt for the domain.
        :param username: If given, change domain username to this value.
        :returns: The modified :class:`Domain <pwm.core.Domain>` object.