def autocontext(getter):
    """A class decorator which marks the class as having an instance which
    can be inferred just from the Client requesting it.

    Argument: A function which accepts the Client attempting to
    resolve an instance and a GlobalContext instance, and returns the
    corresponding instance.

    For example, the Client itself uses this decorator as such:

    @autocontext(lambda client, global_context: client)
    class Client:
        ...

    """
    def decorator(cls):
        if not hasattr(cls, "__api_auto__"):
            setattr(cls, "__api_auto__", getter)
        return cls
    return decorator