def get_callbacks(ns, skip=(), only=False):
    """Deliver all switchio callbacks found in a namespace object yielding
    event `handler` marked functions first followed by non-handlers such as
    callbacks and coroutines.

    :param ns namespace: the namespace object containing marked handlers
    :yields: event_type, callback_type, callback_obj
    """
    non_handlers = []
    for name in (name for name in dir(ns) if name not in skip):
        try:
            obj = object.__getattribute__(ns, name)
        except AttributeError:
            continue
        try:
            ev_types = getattr(obj, 'switchio_init_events', False)
            cb_type = getattr(obj, '_switchio_handler_type', None)
        except ReferenceError:
            continue
        if ev_types:
            if not only or cb_type == only:
                for ev in ev_types:
                    if cb_type == 'handler':
                        yield ev, cb_type, obj
                    else:
                        non_handlers.append((ev, cb_type, obj))
    else:
        for tup in non_handlers:
            yield tup
