def reduce_to_unit(divider):
    """
    Reduce a repeating divider to the smallest repeating unit possible.

    Note: this function is used by make-div
    :param divider: the divider
    :return: smallest repeating unit possible
    :rtype: str

    :Example:
    'XxXxXxX' -> 'Xx'
    """
    for unit_size in range(1, len(divider) // 2 + 1):
        length = len(divider)
        unit = divider[:unit_size]

        # Ignores mismatches in final characters:
        divider_item = divider[:unit_size * (length // unit_size)]
        if unit * (length // unit_size) == divider_item:
            return unit
    return divider
Reduce a repeating divider to the smallest repeating unit possible.

    Note: this function is used by make-div
    :param divider: the divider
    :return: smallest repeating unit possible
    :rtype: str

    :Example:
    'XxXxXxX' -> 'Xx'