def log_operation(entities, operation_name, params=None):
if isinstance(entities, (list, tuple)):<EOL><INDENT>entities = list(entities)<EOL><DEDENT>else:<EOL><INDENT>entities = [entities]<EOL><DEDENT>p = {'<STR_LIT:name>': operation_name, '<STR_LIT>': entities}<EOL>if params:<EOL><INDENT>p['<STR_LIT>'] = params<EOL><DEDENT>_log(TYPE_CODES.OPERATION, p)<EOL>
Logs an operation done on an entity, possibly with other arguments