def set_pkg_chk_sum(self, doc, chk_sum):
self.assert_package_exists()<EOL>if not self.package_chk_sum_set:<EOL><INDENT>self.package_chk_sum_set = True<EOL>doc.package.check_sum = checksum_from_sha1(chk_sum)<EOL>return True<EOL><DEDENT>else:<EOL><INDENT>raise CardinalityError('<STR_LIT>')<EOL><DEDENT>
Sets the package check sum, if not already set.
        chk_sum - A string
        Raises CardinalityError if already defined.
        Raises OrderError if no package previously defined.