Calculate how many padding bytes needed for ``fmt`` to be aligned to
    ``align``.

    Args:
        fmt (str): :mod:`struct` format.
        align (int): alignment (2, 4, 8, etc.)

    Returns:
        str: padding format (e.g., various number of 'x').

    >>> calc_padding('b', 2)
    'x'

    >>> calc_padding('b', 3)
    'xx'

def calc_padding(fmt, align):
    """Calculate how many padding bytes needed for ``fmt`` to be aligned to
    ``align``.

    Args:
        fmt (str): :mod:`struct` format.
        align (int): alignment (2, 4, 8, etc.)

    Returns:
        str: padding format (e.g., various number of 'x').

    >>> calc_padding('b', 2)
    'x'

    >>> calc_padding('b', 3)
    'xx'
    """
    remain = struct.calcsize(fmt) % align
    if remain == 0:
        return ""
    return 'x' * (align - remain)