def right_align_return_tracks_track_assigner(song, tracks_provider):
 offset = tracks_provider.track_offset
 tracks = tracks_provider.tracks_to_use()
 return_tracks = list(song.return_tracks)
 size = tracks_provider.num_tracks
 num_empty_tracks = max(0, ((size + offset) - len(tracks)))
 track_list = (size * [None])
 for i in xrange(size):
  track_index = (i + offset)
  if (len(tracks) > track_index):
   track = tracks[track_index]
   empty_offset = (0 if (tracks[track_index] not in return_tracks) else num_empty_tracks)
   track_list[(i + empty_offset)] = track
 return track_list

def right_align_return_tracks_track_assigner ( song , tracks_provider ) : offset = tracks_provider . track_offset tracks = tracks_provider . tracks_to_use ( ) return_tracks = list ( song . return_tracks ) size = tracks_provider . num_tracks num_empty_tracks = max ( 0 , ( ( size + offset ) - len ( tracks ) ) ) track_list = ( size * [ None ] ) for i in xrange ( size ) : track_index = ( i + offset ) if ( len ( tracks ) > track_index ) : track = tracks [ track_index ] empty_offset = ( 0 if ( tracks [ track_index ] not in return_tracks ) else num_empty_tracks ) track_list [ ( i + empty_offset ) ] = track return track_list
track assigner which aligns return tracks to the right .