<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_strings(project_base_dir, localization_bundle_path, tmp_directory, exclude_dirs, include_strings_file, special_ui_components_prefix):
 """ Calls the builtin 'genstrings' command with JTLocalizedString as the string to search for, and adds strings extracted from UI elements internationalized with 'JTL' + removes duplications. """


    localization_directory = os.path.join(localization_bundle_path, DEFAULT_LANGUAGE_DIRECTORY_NAME)
    if not os.path.exists(localization_directory):
        os.makedirs(localization_directory)

    localization_file = os.path.join(localization_directory, LOCALIZATION_FILENAME)

    # Creating the same directory tree structure in the tmp directory
    tmp_localization_directory = os.path.join(tmp_directory, DEFAULT_LANGUAGE_DIRECTORY_NAME)
    tmp_localization_file = os.path.join(tmp_localization_directory, LOCALIZATION_FILENAME)

    if os.path.isdir(tmp_localization_directory):
        shutil.rmtree(tmp_localization_directory)
    os.mkdir(tmp_localization_directory)

    logging.info("Running genstrings")

    source_files = extract_source_files(project_base_dir, exclude_dirs)

    genstrings_cmd = 'genstrings -s JTLocalizedString -o %s %s' % (tmp_localization_directory, " ".join(
            ['"%s"' % (source_file,) for source_file in source_files]))

    genstrings_process = subprocess.Popen(genstrings_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                                          stdin=subprocess.PIPE, shell=True)

    genstrings_out, genstrings_err = genstrings_process.communicate()

    remove_empty_comments_from_file(tmp_localization_file)
    add_genstrings_comments_to_file(tmp_localization_file, genstrings_err)

    genstrings_rc = genstrings_process.returncode
    if genstrings_rc != 0:
        logging.fatal("genstrings returned %d, aborting run!", genstrings_rc)
        sys.exit(genstrings_rc)

    create_localized_strings_from_ib_files(project_base_dir, exclude_dirs, tmp_localization_file,
                                           special_ui_components_prefix)

    if include_strings_file:
        target = open_strings_file(tmp_localization_file, "a")
        source = open_strings_file(include_strings_file, "r")
        target.write(source.read())
        source.close()
        target.close()

    handle_duplications(tmp_localization_file)

    if os.path.isfile(localization_file):
        logging.info("Merging old localizable with new one...")
        merge_strings_files(localization_file, tmp_localization_file)
    else:
        logging.info("No Localizable yet, moving the created file...")
        shutil.move(tmp_localization_file, localization_file)