'Given an xml extended hint node such as additional_answer or regexphint,
which contain an answer= attribute, returns True if the given student answer is a match.
The boolean arguments regex_mode and ci_mode control how the answer stored in
the question is treated for the comparison (analogously to check_string).'

def match_hint_node(self, node, given, regex_mode, ci_mode):

    answer = node.get('answer', '').strip()
    if (not answer):
        return False
    if regex_mode:
        flags = 0
        if ci_mode:
            flags = re.IGNORECASE
        try:
            regex = re.compile((('^' + answer) + '$'), flags=(flags | re.UNICODE))
            return re.search(regex, given)
        except Exception:
            return False
    if ci_mode:
        return (answer.lower() == given.lower())
    else:
        return (answer == given)
