code: def _get_mass_by_index(self, index):
          
          if hasattr(index, '__iter__'):
              return sum([self.masses[i] for i in index])
          else:
              return self.masses[index]
docs: where index can either by an integer or a list of integers (returns some of masses)