code: def setActivities(self, *args, **kwargs):
          def activityDate(activity):
              try:
                  return activity['activity']['timestamp']
              except KeyError as kerr:
                  return None
          try:
              activities = self.mambuactivitiesclass(groupId=self['encodedKey'], *args, **kwargs)
          except AttributeError as ae:
              from .mambuactivity import MambuActivities
              self.mambuactivitiesclass = MambuActivities
              activities = self.mambuactivitiesclass(groupId=self['encodedKey'], *args, **kwargs)
          activities.attrs = sorted(activities.attrs, key=activityDate)
          self['activities'] = activities
          return 1