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 '')
          ]
      )
docs: Sort a list of triples by relation name.
  
      Embedded integers are sorted numerically, but otherwise the sorting
      is alphabetic.