def METHOD_NAME(f, example_args, example_kwargs, with_weights) -> List[lbann.Layer]:
    """
    Traces through a function or Module to obtain an LBANN graph.
    :param f: Function or module to trace.
    :param example_args: Positional arguments to pass in for tracing.
    :param example_kwargs: Keyword arguments to pass in for tracing.
    :param with_weights: If True (default), also stores the parameters of
                         the traced model as constant initializers of the LBANN
                         graph's weights.
    :return: An LBANN graph given as a list of Layers.
    """
    converters.load_replacements()
    huggingface = False
    if isinstance(f, nn.Module):
        # Workaround to automatically call Huggingface's tracer
        for m in f.modules():
            if m.__module__.startswith('transformers'):
                huggingface = True
                break
    if huggingface:
        from transformers.utils import fx
        input_names = [k for k, v in example_kwargs.items() if v is not None]
        input_vals = [example_kwargs[k] for k in input_names]
        g = fx.symbolic_trace(f, input_names=input_names)
        try:
            lowering.dynamo_callback(input_names, with_weights, g, input_vals)
        except LBANNGraph as ex:
            return ex.graph
    else:
        # Otherwise, call traced function with the standard tracer
        from torch.fx.experimental import proxy_tensor
        fxf = proxy_tensor.make_fx(f, tracing_mode='real')
        g = fxf(*example_args, *tuple(example_kwargs.values()))
        try:
            lowering.dynamo_callback([], with_weights, g, example_args)
        except LBANNGraph as ex:
            return ex.graph
    raise RuntimeError(
        'Could not extract an LBANN graph while tracing the given PyTorch '
        'module or function')