def METHOD_NAME(config=None):
    """
    :param Config|None config:
    :returns: the global context if Horovod is enabled, or None otherwise.
      If we did not setup the context yet, it will automatically create it.
    :rtype: HorovodContext|None
    """
    global _is_set_up, _ctx
    if _is_set_up:
        return _ctx
    if not config:
        from returnn.config import get_global_config
        config = get_global_config(raise_exception=False)
        if not config:
            return None
    _is_set_up = True
    if not config.is_true("use_horovod"):
        return None
    _ctx = HorovodContext(config=config)
    return _ctx