'Calls a callback when components are ready.'

def call_when_ready(self, callback, components=[], name=None, args=(), kw={}):

    if (callback is None):
        callback = (lambda : None)
        callback.func_name = '<None>'
    if isinstance(components, basestring):
        components = [components]
    elif isinstance(components, set):
        components = list(components)
    else:
        try:
            _ = components[0]
            components = list(components)
        except:
            components = [components]
    if (name is None):
        name = getattr(callback, 'func_name')
        if (name is None):
            name = str(callback)
        else:
            name += '()'
            if hasattr(callback, 'im_class'):
                name = ((getattr(callback.im_class, '__name__', '') + '.') + name)
        if hasattr(callback, '__module__'):
            name += ('    in    ' + callback.__module__)
    entry = (callback, name, components, args, kw)
    self._waiters.append(entry)
    self._try_waiter(entry)
