import math


def pad_width(shape, divisors):
    """Returns the amount to pad each axis of an array on in order to be divisible by its
    corresponding divisor. It is intended to be used to generate the 'pad_width' parameter for
    numpy.pad()."""
    pw = []
    for length, divisor in zip(shape, divisors):
        to_pad = math.ceil(length / divisor) * divisor - length
        if to_pad % 2 == 0:
            pw.append((to_pad // 2, to_pad // 2))
        else:
            pw.append((to_pad // 2, to_pad // 2 + 1))
    return pw