def METHOD_NAME(bus, METHOD_NAME, player):
    if METHOD_NAME.type == Gst.MessageType.TAG:
        t = TagListWrapper(METHOD_NAME.parse_tag(), merge=True)
        for k in t.keys():
            v = str(t[k])
            if not k.endswith("bitrate") and k in tags and \
                    v not in tags[k]:
                tags[k].append(v)
            else:
                tags[k] = [v]
        if "nominal-bitrate" in tags and "bitrate" not in tags:
            tags["bitrate"] = tags["nominal-bitrate"]
        # not everyone sends the codec, so ask the typefind element
        typefind = player.get_by_name("typefind")
        if typefind and typefind.props.caps and "audio-codec" not in tags:
            caps = typefind.props.caps
            if "audio/aac" in caps.to_string():
                tags["audio-codec"] = ["AAC (Advanced Audio Coding)"]
            elif "audio/mpeg" in caps.to_string():
                tags["audio-codec"] = ["MPEG 1 Audio, Layer 3 (MP3)"]
        if not set(NEEDED) - set(tags.keys()):
            ml.quit()
    elif METHOD_NAME.type == Gst.MessageType.ERROR or \
            METHOD_NAME.type == Gst.MessageType.EOS:
        ml.quit()
    elif METHOD_NAME.type == Gst.MessageType.BUFFERING:
        percent = METHOD_NAME.parse_buffering()
        if percent == 100:
            player.set_state(Gst.State.PLAYING)
        else:
            player.set_state(Gst.State.PAUSED)