def update_note(self, note):
        """ function to update a specific note object, if the note object does not
        have a "key" field, a new note is created

        Arguments
            - note (dict): note object to update

        Returns:
            A tuple `(note, status)`

            - note (dict): note object
            - status (int): 0 on sucesss and -1 otherwise

        """

        # use UTF-8 encoding
        # cpbotha: in both cases check if it's not unicode already
        # otherwise you get "TypeError: decoding Unicode is not supported"
        if isinstance(note["content"], str):
            note["content"] = unicode(note["content"], 'utf-8')

        if "tags" in note:
            # if a tag is a string, unicode it, otherwise pass it through
            # unchanged (it's unicode already)
            # using the ternary operator, because I like it: a if test else b
            note["tags"] = [unicode(t, 'utf-8') if isinstance(t, str) else t for t in note["tags"]]

        # determine whether to create a new note or updated an existing one
        if "key" in note:
            url = '%s/%s?auth=%s&email=%s' % (DATA_URL, note["key"],
                                              self.get_token(), self.username)
        else:
            url = '%s?auth=%s&email=%s' % (DATA_URL, self.get_token(), self.username)
        request = Request(url, urllib.quote(json.dumps(note)))
        response = ""
        try:
            response = urllib2.urlopen(request).read()
        except __HOLE__, e:
            return e, -1
        return json.loads(response), 0
dataset/ETHPy150Open cpbotha/nvpy/nvpy/simplenote.py/Simplenote.update_note