def _normalize_padding(padding):
    """Ensure that padding has format (left, right, top, bottom, ...)"""
    if all(isinstance(p, int) for p in padding):
        return padding
    else:
        npadding = []
        for p in padding:
            if isinstance(p, (list, tuple)):
                npadding.extend(p)
            else:
                npadding.append(p)
                npadding.append(p)
        return npadding