def _padding(length):
    """
    Figure out how much padding is required to pad 'length' bits
    up to a round number of bytes.

    e.g. 23 would need padding up to 24 (3 bytes) -> returns 1

    :param length: the length of a bit array
    :return: the number of bits needed to pad the array to a round number of bytes
    """
    if length % 8 != 0:
        floor = length // 8
        return ((floor + 1) * 8) - length
    return 0