import logging


def calculate_batches(total_events, batch_size):
    """
    Calculate number of batches to split events into given a batch size and taking into account evenly divisible batches
    :param total_events: The number of total events
    :type total_events: int
    :param batch_size: The max number of events in a batch
    :type batch_size: int

    Returns: The resulting number of batches
    rtype: int

    """
    batches = None
    try:
        batches = (total_events // batch_size)
        batches = batches + 1 if total_events % batch_size != 0 else batches
    except ZeroDivisionError:
        logging.error('Batch Size cannot be 0')
        raise
    except TypeError:
        logging.error('Total Events and Batch Size must be integers')
        raise
    return batches