def divide(iterable, n):                # pylint: disable=invalid-name
    """Evenly divide elements.

    Arguments
    ---------
    iterable : iterable
    n        : integer
               The number of buckets in which to divide the elements

    Returns
    -------
    The generator produces *n* tuples, each containing a number of elements
    where the number is calculated to be evenly distributed across all of the
    returned tuples.

    The number of tuples returned is always *n* and, thus, may return an empty
    tuple if there is not enough data to distribute.

    In order to determine the number of elements to put in each tuple, the
    iterable is converted into a list. Consider using divide_sizes() and
    manually slicing the iterator if this is not desirable.
    """
    if n <= 0:
        return []
    data = list(iterable)
    base, rem = divmod(len(data), n)
    iterable = iter(data)
    for i in range(n):
        yield tuple(islice(iterable, base + 1 if i < rem else base))
Evenly divide elements.

    Arguments
    ---------
    iterable : iterable
    n        : integer
               The number of buckets in which to divide the elements

    Returns
    -------
    The generator produces *n* tuples, each containing a number of elements
    where the number is calculated to be evenly distributed across all of the
    returned tuples.

    The number of tuples returned is always *n* and, thus, may return an empty
    tuple if there is not enough data to distribute.

    In order to determine the number of elements to put in each tuple, the
    iterable is converted into a list. Consider using divide_sizes() and
    manually slicing the iterator if this is not desirable.