code: def alphanum_order(triples):
      return sorted(
          triples,
          key=lambda t: [
              int(t) if t.isdigit() else t
              for t in re.split(r'([0-9]+)', t.relation or '')
          ]
      )