def required_padding(address, alignment):
    """ Return how many padding bytes are needed to align address """
    rest = address % alignment
    if rest:
        # We need padding bytes:
        return alignment - rest
    return 0