def _validate_derived_from(cursor, model):
derived_from_uri = model.metadata.get('<STR_LIT>')<EOL>if derived_from_uri is None:<EOL><INDENT>return  <EOL><DEDENT>try:<EOL><INDENT>ident_hash = parse_archive_uri(derived_from_uri)<EOL>uuid_, version = split_ident_hash(ident_hash, split_version=True)<EOL><DEDENT>except (ValueError, IdentHashSyntaxError, IdentHashShortId) as exc:<EOL><INDENT>raise exceptions.InvalidMetadata('<STR_LIT>', derived_from_uri,<EOL>original_exception=exc)<EOL><DEDENT>args = [uuid_]<EOL>table = '<STR_LIT>'<EOL>version_condition = '<STR_LIT>'<EOL>if version != (None, None,):<EOL><INDENT>args.extend(version)<EOL>table = '<STR_LIT>'<EOL>version_condition = "<STR_LIT>""<STR_LIT>".format(version[<NUM_LIT:1>] is None and '<STR_LIT>' or '<STR_LIT:=>')<EOL><DEDENT>cursor.execute("""<STR_LIT>"""<EOL>.format(table, version_condition), args)<EOL>try:<EOL><INDENT>_exists = cursor.fetchone()[<NUM_LIT:0>]  <EOL><DEDENT>except TypeError:  <EOL><INDENT>raise exceptions.InvalidMetadata('<STR_LIT>', derived_from_uri)<EOL><DEDENT>model.metadata['<STR_LIT>'] = ident_hash<EOL>
Given a database cursor and model, check the derived-from
    value accurately points to content in the archive.
    The value can be nothing or must point to existing content.