def init(mode=None, **kwargs):
    """Wrapper to create the API object you need to acces the CCU API.

    By default it detects whether or not this code is being executed on the CCU
    or on another system. And initializes either a LocalAPI() object when run
    directly on a CCU or, in all other cases, a RemoteAPI() object. This object
    is then being returned.

    You can provide the mode argument to disable auto detection and either set
    it to "local" to enforce a LocalAPI() object to be created or "remote" to
    enforce a RemoteAPI() object.

    In case a RemoteAPI() object is being created, you need to provide at least
    the additional keyword arguments address="http://[HOST]" which needs to
    contain the base URL to your CCU together with credentials=("[USER]", "PASSWORD")
    which must be valid credentials to authenticate with the CCU.
    """
    if mode is None:
        mode = utils.is_ccu() and "local" or "remote"

    if mode == "local":
        if not utils.is_ccu():
            raise PMException("local mode can only be used on the CCU.")

        return LocalAPI()
    elif mode == "remote":
        try:
            return RemoteAPI(**kwargs)
        except TypeError as e:
            raise PMException("You need to provide at least the address and credentials "
                              "to access your CCU (%s)." % e)
    else:
        raise PMException("Invalid mode given. Valid ones are \"local\" and \"remote\".")