'The callback method will be called by the sasl_bind_s()
method several times. Each time it will provide the id, which
tells us what kind of information is requested (the CB_ ...
constants above). The challenge might be a short (english) text
or some binary string, from which the return value is calculated.
The prompt argument is always a human-readable description string;
The defresult is a default value provided by the sasl library
Currently, we do not use the challenge and prompt information, and
return only information which is stored in the self.cb_value_dict
cb_value_dictionary. Note that the current callback interface is not very
useful for writing generic sasl GUIs, which would need to know all
the questions to ask, before the answers are returned to the sasl
lib (in contrast to one question at a time).'

def callback(self, cb_id, challenge, prompt, defresult):

    cb_result = (self.cb_value_dict.get(cb_id, defresult) or '')
    if __debug__:
        if (_trace_level >= 1):
            _trace_file.write(('***    id=%d,    challenge=%s,    prompt=%s,    defresult=%s\n->    %s\n' % (cb_id, challenge, prompt, repr(defresult), repr(self.cb_value_dict.get(cb_result)))))
    return cb_result
