code: def findunique(lst, key):
      
      return sorted(set([item[key.lower()] for item in lst]))
docs: Find all unique key values for items in lst.
  
      Parameters
      ----------
  
      lst: list
           A list of composite dictionaries e.g. ``layers``, ``classes``
      key: string
          The key name to search each dictionary in the list
  
      Returns
      -------
  
      list
          A sorted Python list of unique keys in the list
  
      Example
      -------
  
      To find all ``GROUP`` values for ``CLASS`` in a ``LAYER``::
  
          s = '''
          LAYER
              CLASS
                  GROUP "group1"
                  NAME "Class1"
                  COLOR 0 0 0
              END
              CLASS
                  GROUP "group2"
                  NAME "Class2"
                  COLOR 0 0 0
              END
              CLASS
                  GROUP "group1"
                  NAME "Class3"
                  COLOR 0 0 0
              END
          END
          '''
  
          d = mappyfile.loads(s)
          groups = mappyfile.findunique(d["classes"], "group")
          assert groups == ["group1", "group2"]