Compare two blocks of characters

    Compares two blocks of characters of the form returned by either
    the :any:`_pop_digits` or :any:`_pop_letters` function. Blocks
    should be character lists containing only digits or only letters.
    Both blocks should contain the same character type (digits or
    letters).

    The method of comparison mirrors the method used by RPM. If the
    blocks are digit blocks, any leading zeros are trimmed, and
    whichever block is longer is assumed to be larger. If the resultant
    blocks are the same length, or if the blocks are non-numeric, they
    are checked for string equality and considered equal if the string
    equality comparison returns True. If not, whichever evaluates as
    greater than the other (again in string comparison) is assumed to be
    larger.

    :param list block_a: an all numeric or all alphabetic character
        list
    :param list block_b: an all numeric or all alphabetic character
        list. Alphabetic or numeric character should match ``block_a``
    :return: 1 (if ``a`` is newer), 0 (if versions are equal) or
        -1 (if ``b`` is newer)
    :rtype: int

def _compare_blocks(block_a, block_b):
    """Compare two blocks of characters

    Compares two blocks of characters of the form returned by either
    the :any:`_pop_digits` or :any:`_pop_letters` function. Blocks
    should be character lists containing only digits or only letters.
    Both blocks should contain the same character type (digits or
    letters).

    The method of comparison mirrors the method used by RPM. If the
    blocks are digit blocks, any leading zeros are trimmed, and
    whichever block is longer is assumed to be larger. If the resultant
    blocks are the same length, or if the blocks are non-numeric, they
    are checked for string equality and considered equal if the string
    equality comparison returns True. If not, whichever evaluates as
    greater than the other (again in string comparison) is assumed to be
    larger.

    :param list block_a: an all numeric or all alphabetic character
        list
    :param list block_b: an all numeric or all alphabetic character
        list. Alphabetic or numeric character should match ``block_a``
    :return: 1 (if ``a`` is newer), 0 (if versions are equal) or
        -1 (if ``b`` is newer)
    :rtype: int
    """
    logger.debug('_compare_blocks(%s, %s)', block_a, block_b)
    if block_a[0].isdigit():
        _trim_zeros(block_a, block_b)
        if len(block_a) != len(block_b):
            logger.debug('block lengths are not equal')
            return a_newer if len(block_a) > len(block_b) else b_newer
    if block_a == block_b:
        logger.debug('blocks are equal')
        return a_eq_b
    else:
        logger.debug('blocks are not equal')
        return a_newer if block_a > block_b else b_newer