def METHOD_NAME(function, *args, use_reentrant: bool = True, **kwargs):
    # Hack to mix *args with **kwargs in a python 2.7-compliant way
    preserve = kwargs.pop("preserve_rng_state", True)
    # Hack to put kwargs into args
    all_args = list(args)
    if kwargs:
        for x in kwargs:
            all_args.append(kwargs[x])
    if use_reentrant:
        return CheckpointFunction.apply(function, preserve, *all_args)
    else:
        return _checkpoint_without_reentrant(function, preserve, *all_args)