def METHOD_NAME(self, filetypes):
    import collections
    extensions = collections.defaultdict(list)
    names = []
    for name, ext in filetypes:
        if ext.startswith('.'):
            ext = '*' + ext
        extensions[name].append(ext)
        if name not in names:
            names.append(name)
    return ';;'.join('%s (%s)' % (name, ' '.join(extensions[name]))
            for name in names)