'Creates a <numtolerance_input/>  or <decoy_input/> element with
optionally specified tolerance and answer.'

def _create_numtolerance_input_element(self, params):

    answer = (params['answer'] if ('answer' in params) else None)
    if answer:
        text_input = etree.Element('numtolerance_input')
        text_input.set('answer', answer)
        text_input.set('tolerance', (params['tolerance'] if ('tolerance' in params) else '0'))
    else:
        text_input = etree.Element('decoy_input')
    return text_input
