'Checks that the argument sent to a jQuery DOM insertion function is a
safe call to HtmlUtils.
A safe argument is of the form:
- HtmlUtils.xxx(anything).toString()
- edx.HtmlUtils.xxx(anything).toString()
Arguments:
argument: The argument sent to the jQuery function (e.g.
append(argument)).
Returns:
True if the argument is safe, and False otherwise.'

def _is_jquery_argument_safe_html_utils_call(self, argument):

    match = re.search('(?:edx\\.)?HtmlUtils\\.[a-zA-Z0-9]+\\(.*\\)\\.toString\\(\\)', argument)
    return ((match is not None) and (match.group() == argument))
