def calculate_uuid(self):
<EOL>if self.uuid_input_fields is None:<EOL><INDENT>raise NotImplementedError("""<STR_LIT>""")<EOL><DEDENT>if self.uuid_input_fields == "<STR_LIT>":<EOL><INDENT>return uuid.uuid4().hex<EOL><DEDENT>assert isinstance(self.uuid_input_fields, tuple), "<STR_LIT>"<EOL>hashable_input_vals = []<EOL>for field in self.uuid_input_fields:<EOL><INDENT>new_value = getattr(self, field)<EOL>if new_value:<EOL><INDENT>hashable_input_vals.append(str(new_value))<EOL><DEDENT><DEDENT>hashable_input = "<STR_LIT::>".join(hashable_input_vals)<EOL>if not hashable_input:<EOL><INDENT>return uuid.uuid4().hex<EOL><DEDENT>return sha2_uuid(hashable_input)<EOL>
Should return a 32-digit hex string for a UUID that is calculated as a function of a set of fields from the model.