'Create a <numericalresponse> XML element.
Uses **kwarg keys:
*answer*: The correct answer (e.g. "5")
*correcthint*: The feedback describing correct answer.
*additional_answers*: A dict of additional answers along with their correcthint.
*tolerance*: The tolerance within which a response
is considered correct.  Can be a decimal (e.g. "0.01")
or percentage (e.g. "2%")
*credit_type*: String of comma-separated words specifying the
partial credit grading scheme.
*partial_range*: The multiplier for the tolerance that will
still provide partial credit in the "close" grading style
*partial_answers*: A string of comma-separated alternate
answers that will receive partial credit in the "list" style'

def create_response_element(self, **kwargs):

    answer = kwargs.get('answer', None)
    correcthint = kwargs.get('correcthint', '')
    additional_answers = kwargs.get('additional_answers', {})
    tolerance = kwargs.get('tolerance', None)
    credit_type = kwargs.get('credit_type', None)
    partial_range = kwargs.get('partial_range', None)
    partial_answers = kwargs.get('partial_answers', None)
    response_element = etree.Element('numericalresponse')
    if answer:
        if isinstance(answer, float):
            response_element.set('answer', repr(answer))
        else:
            response_element.set('answer', str(answer))
    for (additional_answer, additional_correcthint) in additional_answers.items():
        additional_element = etree.SubElement(response_element, 'additional_answer')
        additional_element.set('answer', str(additional_answer))
        if additional_correcthint:
            correcthint_element = etree.SubElement(additional_element, 'correcthint')
            correcthint_element.text = str(additional_correcthint)
    if tolerance:
        responseparam_element = etree.SubElement(response_element, 'responseparam')
        responseparam_element.set('type', 'tolerance')
        responseparam_element.set('default', str(tolerance))
        if ((partial_range is not None) and ('close' in credit_type)):
            responseparam_element.set('partial_range', str(partial_range))
    if ((partial_answers is not None) and ('list' in credit_type)):
        responseparam_element = etree.SubElement(response_element, 'responseparam')
        responseparam_element.set('partial_answers', partial_answers)
    if correcthint:
        correcthint_element = etree.SubElement(response_element, 'correcthint')
        correcthint_element.text = str(correcthint)
    return response_element
