<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_track(self, track):
 """Add a track to the composition. Raise an UnexpectedObjectError if the argument is not a mingus.containers.Track object. """

        if not hasattr(track, 'bars'):
            raise UnexpectedObjectError("Unexpected object '%s', "
                    "expecting a mingus.containers.Track object" % track)
        self.tracks.append(track)
        self.selected_tracks = [len(self.tracks) - 1]