def split_list(input_list, split_length, drop_last=False):
    """
    Split a list into sublists, each with a length of split_length.

    Args:
    - input_list (list): The list to be split.
    - split_length (int): Length of each sublist.
    - drop_last (bool): Whether to drop the last sublist if its length is insufficient. Default is False.

    Returns:
    - list of lists: List of split sublists.

    Example:
    >>> input_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    >>> split_length = 5
    >>> result = split_list(input_list, split_length, drop_last=False)
    >>> print(result)  # Output: [[1, 2, 3, 4, 5], [6, 7, 8, 9]]
    """
    if split_length <= 0:
        raise ValueError("split_length must be a positive integer!")

    num_elements = len(input_list)
    num_splits = num_elements // split_length

    sublists = [
        input_list[i * split_length : (i + 1) * split_length] for i in range(num_splits)
    ]

    if not drop_last and num_splits * split_length < num_elements:
        sublists.append(input_list[num_splits * split_length :])

    return sublists

    Split a list into sublists, each with a length of split_length.

    Args:
    - input_list (list): The list to be split.
    - split_length (int): Length of each sublist.
    - drop_last (bool): Whether to drop the last sublist if its length is insufficient. Default is False.

    Returns:
    - list of lists: List of split sublists.

    Example:
    >>> input_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    >>> split_length = 5
    >>> result = split_list(input_list, split_length, drop_last=False)
    >>> print(result)  # Output: [[1, 2, 3, 4, 5], [6, 7, 8, 9]]
    
smoe/utils/operations/operation_list.py