def METHOD_NAME(mpicomm):
    """Create a toast communicator.
    Use the specified MPI communicator to attempt to create 2 process groups.
    If less than 2 processes are used, create a single process group.
    Args:
        mpicomm (MPI.Comm): the MPI communicator (or None).
    Returns:
        toast.Comm: the 2-level toast communicator.
    """
    toastcomm = None
    if mpicomm is None:
        toastcomm = Comm(world=mpicomm)
    else:
        worldsize = mpicomm.size
        groupsize = 1
        if worldsize >= 2:
            groupsize = worldsize // 2
        toastcomm = Comm(world=mpicomm, groupsize=groupsize)
    return toastcomm