def get_profiles(self, overwrite=False):
        def sort_by_locale(unsorted_profiles, locale):
            if locale is None:
                return unsorted_profiles
            locale = '_%s' % locale[:2]
            profiles_our_locale = []
            profiles_remaining = []
            for profile_name in unsorted_profiles:
                if locale in profile_name:
                    profiles_our_locale.append(profile_name)
                else:
                    profiles_remaining.append(profile_name)
            return profiles_our_locale + profiles_remaining
        if not self.root_directory:
            profiles = []
            return profiles
        else:
            locale_minimum_needs_dir = os.path.join(
                self.root_directory, 'minimum_needs')
            path_name = resources_path('minimum_needs')
            if not os.path.exists(locale_minimum_needs_dir):
                os.makedirs(locale_minimum_needs_dir)
            for file_name in os.listdir(path_name):
                source_file = os.path.join(path_name, file_name)
                destination_file = os.path.join(
                    locale_minimum_needs_dir, file_name)
                if not os.path.exists(destination_file) or overwrite:
                    copy(source_file, destination_file)
            self.move_old_profile(locale_minimum_needs_dir)
            profiles = [
                profile[:-5] for profile in
                os.listdir(locale_minimum_needs_dir) if
                profile[-5:] == '.json']
            profiles = sort_by_locale(profiles, self.locale)
            return profiles