code: def setRepayments(self, *args, **kwargs):
          def duedate(repayment):
              try:
                  return repayment['dueDate']
              except KeyError as kerr:
                  return datetime.now()
          try:
              reps = self.mamburepaymentsclass(entid=self['id'], *args, **kwargs)
          except AttributeError as ae:
              from .mamburepayment import MambuRepayments
              self.mamburepaymentsclass = MambuRepayments
              reps = self.mamburepaymentsclass(entid=self['id'], *args, **kwargs)
          reps.attrs = sorted(reps.attrs, key=duedate)
          self['repayments'] = reps
          return 1