code: def addparentstofks(rels, fks):
      
      for j in rels:
          son = index(fks, j[1])
          parent = index(fks, j[0])
          fks[son][2] = fks[son][2].replace("models.Model", parent)
          if parent not in fks[son][0]:
              fks[son][0].append(parent)
docs: Get a list of relations, between parents and sons and a dict of
      clases named in dia, and modifies the fks to add the parent as fk to get
      order on the output of classes and replaces the base class of the son, to
      put the class parent name.