def METHOD_NAME(self, process_group: ProcessGroup = None) -> bool:
    """
    Check if the current process is the last process (rank is world size - 1). It can accept a sub process group to check the last rank with respect to the process.
    Args:
        process_group (ProcessGroup, optional): process group to use for the last rank check. Defaults to None, which refers to the default process group.
    Returns:
        bool: True if the current process is the last process, False otherwise
    """
    rank = dist.get_rank(group=process_group)
    world_size = dist.get_world_size(group=process_group)
    return rank == world_size - 1