def get_current_context_id():
    """Identifis which context it is (greenlet, stackless, or thread).

    :returns: the identifier of the current context.

    """
    global get_current_context_id
    if greenlet is not None:
        if stackless is None:
            get_current_context_id = greenlet.getcurrent
            return greenlet.getcurrent()
        return greenlet.getcurrent(), stackless.getcurrent()
    elif stackless is not None:
        get_current_context_id = stackless.getcurrent
        return stackless.getcurrent()
    get_current_context_id = _thread.get_ident
    return _thread.get_ident()
Identifis which context it is (greenlet, stackless, or thread).

    :returns: the identifier of the current context.