code: def make_new_subdomain_history(self, cursor, subdomain_rec):
          
          # what's the subdomain's history up until this subdomain record?
          hist = self.subdomain_db.get_subdomain_history(subdomain_rec.get_fqn(), include_unaccepted=True, end_sequence=subdomain_rec.n+1, end_zonefile_index=subdomain_rec.parent_zonefile_index+1, cur=cursor)
          assert len(hist) > 0, 'BUG: not yet stored: {}'.format(subdomain_rec)
  
          for i in range(0, len(hist)):
              hist[i].accepted = False
  
          hist.sort(lambda h1, h2: -1 if h1.n < h2.n or (h1.n == h2.n and h1.parent_zonefile_index < h2.parent_zonefile_index) \
                                   else 0 if h1.n == h2.n and h1.parent_zonefile_index == h2.parent_zonefile_index \
                                   else 1)
  
          if not self.check_initial_subdomain(hist[0]):
              log.debug("Reject initial {}".format(hist[0]))
              return hist
          else:
              log.debug("Accept initial {}".format(hist[0]))
              pass
  
          hist[0].accepted = True
          last_accepted = 0
  
          for i in xrange(1, len(hist)):
              if self.check_subdomain_transition(hist[last_accepted], hist[i]):
                  log.debug("Accept historic update {}".format(hist[i]))
                  hist[i].accepted = True
                  last_accepted = i
              else:
                  log.debug("Reject historic update {}".format(hist[i]))
                  hist[i].accepted = False
  
          return hist
docs: Recalculate the history for this subdomain from genesis up until this record.
          Returns the list of subdomain records we need to save.