def republish_binders(cursor, models):
documents = set([])<EOL>binders = set([])<EOL>history_mapping = {}  <EOL>if not isinstance(models, (list, tuple, set,)):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>".format(models))<EOL><DEDENT>for model in models:<EOL><INDENT>if isinstance(model, (cnxepub.Binder,)):<EOL><INDENT>binders.add(split_ident_hash(model.ident_hash)[<NUM_LIT:0>])<EOL>for doc in cnxepub.flatten_to_documents(model):<EOL><INDENT>documents.add(split_ident_hash(doc.ident_hash))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>documents.add(split_ident_hash(model.ident_hash))<EOL><DEDENT><DEDENT>to_be_republished = []<EOL>for (uuid, version) in documents:<EOL><INDENT>ident_hash = join_ident_hash(uuid, version)<EOL>previous_ident_hash = get_previous_publication(cursor, ident_hash)<EOL>if previous_ident_hash is None:<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>history_mapping[previous_ident_hash] = ident_hash<EOL><DEDENT>cursor.execute(
Republish the Binders that share Documents in the publication context.
    This needs to be given all the models in the publication context.