def serialize_groups(self, groups, path, portal=None):
        """ Serialize groups to CSV. """
        groups_copy = copy.deepcopy(groups)
        field_names = GROUP_EXTRACT_PROPERTIES

        if self.thumbnails:
            if not portal:
                raise PortalError('The "portal" argument is required to  '\
                                  + 'download thumbnails')
            field_names.append('thumbnail')
            base_dir = os.path.dirname(path)
            for i, group in enumerate(groups):
                if group in 'thumbnail':
                    group_dir = os.path.join(base_dir, group['id'])
                    thumbnail_path = portal.group_thumbnaild(
                        group['id'], group_dir, group['thumbnail'])
                    groups_copy[i]['thumbnail'] = os.path.relpath(
                        thumbnail_path, base_dir)

        group_writer = csv.DictWriter(open(path, "wb"), field_names)
        group_writer.writeheader()
        group_writer.writerows(groups_copy)
dataset/ETHPy150Open Esri/ops-server-config/Publish/Portal/portalpy/provision.py/CSVSerializer.serialize_groups/swapped operands of `in`