def options_mask(xmp_options, **kwargs):
    """
    Creates the options bit mask for consumption by exempi C functions.

    Example::

      opt = consts.options_mask( consts.XMP_SERIAL_OPTIONS, **kwargs )

    or::

      opt = consts.options_mask( consts.XMP_SERIAL_OPTIONS, omit_packet_wrapper=True )
    """
    bitmask = 0
    for const_name, const_value in kwargs.items():
        if const_value and const_name in xmp_options:
            bitmask |= xmp_options[const_name]
    return bitmask
