'Compute track replay gain and store it in the item.
If ``write`` is truthy then ``item.write()`` is called to write
the data to disk.  If replay gain information is already present
in the item, nothing is done.'

def handle_track(self, item, write):

    if (not self.track_requires_gain(item)):
        self._log.info(u'Skipping    track    {0}', item)
        return
    self._log.info(u'analyzing    {0}', item)
    if self.should_use_r128(item):
        if (self.r128_backend_instance == ''):
            self.init_r128_backend()
        backend_instance = self.r128_backend_instance
        store_track_gain = self.store_track_r128_gain
    else:
        backend_instance = self.backend_instance
        store_track_gain = self.store_track_gain
    try:
        track_gains = backend_instance.compute_track_gain([item])
        if (len(track_gains) != 1):
            raise ReplayGainError(u'ReplayGain    backend    failed    for    track    {0}'.format(item))
        store_track_gain(item, track_gains[0])
        if write:
            item.try_write()
    except ReplayGainError as e:
        self._log.info(u'ReplayGain    error:    {0}', e)
    except FatalReplayGainError as e:
        raise ui.UserError(u'Fatal    replay    gain    error:    {0}'.format(e))
