code: def find(lst, key, value):
      
      return next((item for item in lst if item[key.lower()] == value), None)
docs: Find an item in a list of dicts using a key and a value
  
      Parameters
      ----------
  
      list: list
          A list of composite dictionaries e.g. ``layers``, ``classes``
      key: string
          The key name to search each dictionary in the list
      key: value
          The value to search for
  
      Returns
      -------
  
      dict
          The first composite dictionary object with a key that matches the value
  
      Example
      -------
  
      To find the ``LAYER`` in a list of layers with ``NAME`` set to ``Layer2``::
  
          s = '''
          MAP
              LAYER
                  NAME "Layer1"
                  TYPE POLYGON
              END
              LAYER
                  NAME "Layer2"
                  TYPE POLYGON
                  CLASS
                      NAME "Class1"
                      COLOR 0 0 -8
                  END
              END
          END
          '''
  
          d = mappyfile.loads(s)
          cmp = mappyfile.find(d["layers"], "name", "Layer2")
          assert cmp["name"] == "Layer2"