def add_note(self, note, octave=None, dynamics={}):
        """Add a note to the container and sorts the notes from low to high.

        The note can either be a string, in which case you could also use
        the octave and dynamics arguments, or a Note object.
        """
        if type(note) == str:
            if octave is not None:
                note = Note(note, octave, dynamics)
            elif len(self.notes) == 0:
                note = Note(note, 4, dynamics)
            else:
                if Note(note, self.notes[-1].octave) < self.notes[-1]:
                    note = Note(note, self.notes[-1].octave + 1, dynamics)
                else:
                    note = Note(note, self.notes[-1].octave, dynamics)
        if not hasattr(note, 'name'):
            raise UnexpectedObjectError("Object '%s' was not expected. "
                    "Expecting a mingus.containers.Note object." % note)
        if note not in self.notes:
            self.notes.append(note)
            self.notes.sort()
        return self.notes
Add a note to the container and sorts the notes from low to high.

        The note can either be a string, in which case you could also use
        the octave and dynamics arguments, or a Note object.