def closelog(): global _S_log_open, S_ident_o if _S_log_open: lib.closelog() _S_log_open = False _S_ident_o = None