<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_notes(self, note, duration=None):
 """Add a Note, note as string or NoteContainer to the last Bar. If the Bar is full, a new one will automatically be created. If the Bar is not full but the note can't fit in, this method will return False. True otherwise. An InstrumentRangeError exception will be raised if an Instrument is attached to the Track, but the note turns out not to be within the range of the Instrument. """

        if self.instrument != None:
            if not self.instrument.can_play_notes(note):
                raise InstrumentRangeError, \
                    "Note '%s' is not in range of the instrument (%s)" % (note,
                        self.instrument)
        if duration == None:
            duration = 4

        # Check whether the last bar is full, if so create a new bar and add the
        # note there
        if len(self.bars) == 0:
            self.bars.append(Bar())
        last_bar = self.bars[-1]
        if last_bar.is_full():
            self.bars.append(Bar(last_bar.key, last_bar.meter))
            # warning should hold note if it doesn't fit

        return self.bars[-1].place_notes(note, duration)