def _to_packing_fmt(dds_types):
    """ Calculate packing format for struct.pack

    Args:
        dds_types(list): list of member types

    Returns:
        packing format string
    """
    result = []
    for val in dds_types:
        if 'Short' == val:
            result.append('h')
        elif 'UShort' == val:
            result.append('H')
        elif 'Boolean' == val:
            result.append('?')
        elif 'Long' == val:
            result.append('i')
        elif 'ULong' == val:
            result.append('I')
        elif 'LongLong' == val:
            result.append('q')
        elif 'ULongLong' == val:
            result.append('Q')
        elif 'Float' == val:
            result.append('f')
        elif 'Double' == val:
            result.append('d')
        elif 'Char' == val:
            result.append('c')
        elif 'Octet' == val:
            result.append('B')
        elif 'String' == val:
            result.append('P')
        elif 'Enum' == val:
            result.append('i')
        elif 'Sequence' == val:
            result.append('iiP?')
    return ' '.join(result)