def write_package(package, out):
out.write('<STR_LIT>')<EOL>write_value('<STR_LIT>', package.name, out)<EOL>if package.has_optional_field('<STR_LIT:version>'):<EOL><INDENT>write_value('<STR_LIT>', package.version, out)<EOL><DEDENT>write_value('<STR_LIT>', package.download_location, out)<EOL>if package.has_optional_field('<STR_LIT>'):<EOL><INDENT>write_text_value('<STR_LIT>', package.summary, out)<EOL><DEDENT>if package.has_optional_field('<STR_LIT>'):<EOL><INDENT>write_text_value('<STR_LIT>', package.source_info, out)<EOL><DEDENT>if package.has_optional_field('<STR_LIT>'):<EOL><INDENT>write_value('<STR_LIT>', package.file_name, out)<EOL><DEDENT>if package.has_optional_field('<STR_LIT>'):<EOL><INDENT>write_value('<STR_LIT>', package.supplier, out)<EOL><DEDENT>if package.has_optional_field('<STR_LIT>'):<EOL><INDENT>write_value('<STR_LIT>', package.originator, out)<EOL><DEDENT>if package.has_optional_field('<STR_LIT>'):<EOL><INDENT>write_value('<STR_LIT>', package.check_sum.to_tv(), out)<EOL><DEDENT>write_value('<STR_LIT>', format_verif_code(package), out)<EOL>if package.has_optional_field('<STR_LIT:description>'):<EOL><INDENT>write_text_value('<STR_LIT>', package.description, out)<EOL><DEDENT>if isinstance(package.license_declared, (document.LicenseConjunction,<EOL>document.LicenseDisjunction)):<EOL><INDENT>write_value('<STR_LIT>', u'<STR_LIT>'.format(package.license_declared), out)<EOL><DEDENT>else:<EOL><INDENT>write_value('<STR_LIT>', package.license_declared, out)<EOL><DEDENT>if isinstance(package.conc_lics, (document.LicenseConjunction,<EOL>document.LicenseDisjunction)):<EOL><INDENT>write_value('<STR_LIT>', u'<STR_LIT>'.format(package.conc_lics), out)<EOL><DEDENT>else:<EOL><INDENT>write_value('<STR_LIT>', package.conc_lics, out)<EOL><DEDENT>for lics in sorted(package.licenses_from_files):<EOL><INDENT>write_value('<STR_LIT>', lics, out)<EOL><DEDENT>if package.has_optional_field('<STR_LIT>'):<EOL><INDENT>write_text_value('<STR_LIT>', package.license_comment, out)<EOL><DEDENT>if isinstance(package.cr_text, six.string_types):<EOL><INDENT>write_text_value('<STR_LIT>', package.cr_text, out)<EOL><DEDENT>else:<EOL><INDENT>write_value('<STR_LIT>', package.cr_text, out)<EOL><DEDENT>if package.has_optional_field('<STR_LIT>'):<EOL><INDENT>write_value('<STR_LIT>', package.homepage, out)<EOL><DEDENT>for spdx_file in sorted(package.files):<EOL><INDENT>write_separators(out)<EOL>write_file(spdx_file, out)<EOL><DEDENT>
Write a package fields to out.