<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _export_profiles(self, profile_name, user_pageviews, user_downloads, ip_user=False):
 """Filter and export the user profiles."""

        views_min = self.config.get('user_views_min')
        views_max = self.config.get('user_views_max')
        ip_user_id = 500000000000
        add_user_id = 100000000000
        stat_records = 0
        with self.storage.get_user_profiles(profile_name) as store:
            store.clear()
            for user in user_pageviews:
                # Only users with unique pageviews.
                unique_views = len(set(user_pageviews[user]))
                if views_max > unique_views >= views_min:
                    nodes, weight = self._calculate_user_record_weights(
                            record_list=user_pageviews[user],
                            download_list=user_downloads.get(user))
                    if ip_user:
                        store.add_user(ip_user_id, nodes, weight)
                        ip_user_id += 1
                    else:
                        user = str(add_user_id + int(user))
                        store.add_user(user, nodes, weight)
                    self.stat_long['User_num_records'].append(len(nodes))
                    stat_records += len(nodes)

                elif unique_views >= views_min:
                    # TODO: Add stat for to many views.
                    print("Drop user {} with {} views".format(user,
                                                              unique_views))
        self.stat['user_profiles'] = len(self.stat_long.get(
                                                        'User_num_records'))
        self.stat['user_profiles_records'] = stat_records

        print("Stats: {}".format(self.stat))