def notify_user(<EOL>self,<EOL>msg,<EOL>level="<STR_LIT:error>",<EOL>rate_limit=None,<EOL>module_name="<STR_LIT>",<EOL>icon=None,<EOL>title="<STR_LIT>",<EOL>):
dbus = self.config.get("<STR_LIT>")<EOL>if dbus:<EOL><INDENT>title = u"<STR_LIT:{}>".format(title)<EOL>msg = u"<STR_LIT:{}>".format(msg)<EOL>if icon:<EOL><INDENT>icon = u"<STR_LIT:{}>".format(icon)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>msg = u"<STR_LIT>".format(msg)<EOL><DEDENT>if level != "<STR_LIT:info>" and module_name == "<STR_LIT>":<EOL><INDENT>fix_msg = u"<STR_LIT>"<EOL>msg = fix_msg.format(msg)<EOL><DEDENT>limit_key = "<STR_LIT>"<EOL>if rate_limit:<EOL><INDENT>try:<EOL><INDENT>limit_key = time.time() // rate_limit<EOL><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>msg_hash = hash(u"<STR_LIT>".format(module_name, limit_key, msg, title))<EOL>if msg_hash in self.notified_messages:<EOL><INDENT>return<EOL><DEDENT>elif module_name:<EOL><INDENT>log_msg = '<STR_LIT>' % (<EOL>module_name,<EOL>title,<EOL>msg,<EOL>)<EOL>self.log(log_msg, level)<EOL><DEDENT>else:<EOL><INDENT>self.log(msg, level)<EOL><DEDENT>self.notified_messages.add(msg_hash)<EOL>try:<EOL><INDENT>if dbus:<EOL><INDENT>msg = msg.replace("<STR_LIT:&>", "<STR_LIT>")<EOL>msg = msg.replace("<STR_LIT:<>", "<STR_LIT>")<EOL>msg = msg.replace("<STR_LIT:>>", "<STR_LIT>")<EOL>cmd = ["<STR_LIT>"]<EOL>if icon:<EOL><INDENT>cmd += ["<STR_LIT>", icon]<EOL><DEDENT>cmd += ["<STR_LIT>", DBUS_LEVELS.get(level, "<STR_LIT>"), "<STR_LIT>", "<STR_LIT>"]<EOL>cmd += [title, msg]<EOL><DEDENT>else:<EOL><INDENT>py3_config = self.config.get("<STR_LIT>", {})<EOL>nagbar_font = py3_config.get("<STR_LIT>", {}).get("<STR_LIT>")<EOL>wm_nag = self.config["<STR_LIT>"]["<STR_LIT>"]<EOL>cmd = [wm_nag, "<STR_LIT>", msg, "<STR_LIT>", level]<EOL>if nagbar_font:<EOL><INDENT>cmd += ["<STR_LIT>", nagbar_font]<EOL><DEDENT><DEDENT>Popen(cmd, stdout=open("<STR_LIT>", "<STR_LIT:w>"), stderr=open("<STR_LIT>", "<STR_LIT:w>"))<EOL><DEDENT>except Exception as err:<EOL><INDENT>self.log("<STR_LIT>" % err)<EOL><DEDENT>
Display notification to user via i3-nagbar or send-notify
We also make sure to log anything to keep trace of it.

NOTE: Message should end with a '.' for consistency.