def getMapLayerIds(map):
  def traverse(o):
    for value in o:
      if "contents" in value:
        for subvalue in traverse(value["contents"]):
          yield subvalue

      elif "type" in value and value["type"] == "layer":
        yield value["id"]

  return traverse(map["contents"])
Extracts the layerIds from a map's contents block.
dataset/ETHPy150Open keithmoss/Hodor/hodor/gme.py/getMapLayerIds