code: def sorted_by_attr(vals, attr, reverse=False):
      """Sort sequence <vals> by using attribute/key <attr> for each item in the sequence."""
      return sorted(vals, key=lambda x: x[attr], reverse=reverse)
  
imports: import xml.etree.ElementTree
  from collections import OrderedDict
  import json
  import struct
  import imghdr
  import numpy
  from .geom import pt, rect
label_desc: Use image node_id 15 for calling a global function with example usage: sorted_by_attr(vals, attr, reverse) and returns: sorted