code: def read_scenarios(filename):
      
      # Input checks
      filename = os.path.abspath(filename)
  
      blocks = {}
      parser = ConfigParser()
  
      # Parse the file content.
      # if the content don't have section header
      # we use the filename.
      try:
          parser.read(filename)
      except MissingSectionHeaderError:
          base_name = os.path.basename(filename)
          name = os.path.splitext(base_name)[0]
          section = '[%s]\n' % name
          content = section + open(filename).read()
          parser.readfp(StringIO(content))
  
      # convert to dictionary
      for section in parser.sections():
          items = parser.items(section)
          # add section as scenario name
          items.append(('scenario_name', section))
          # add full path to the blocks
          items.append(('full_path', filename))
          blocks[section] = {}
          for key, value in items:
              blocks[section][key] = value
  
      # Ok we have generated a structure that looks like this:
      # blocks = {{ 'foo' : { 'a': 'b', 'c': 'd'},
      #           { 'bar' : { 'd': 'e', 'f': 'g'}}
      # where foo and bar are scenarios and their dicts are the options for
      # that scenario (e.g. hazard, exposure etc)
      return blocks
docs: Read keywords dictionary from file.
  
      :param filename: Name of file holding scenarios .
  
      :return Dictionary of with structure like this
          {{ 'foo' : { 'a': 'b', 'c': 'd'},
              { 'bar' : { 'd': 'e', 'f': 'g'}}
  
      A scenarios file may look like this:
  
          [jakarta_flood]
          hazard: /path/to/hazard.tif
          exposure: /path/to/exposure.tif
          function: function_id
          aggregation: /path/to/aggregation_layer.tif
          extent: minx, miny, maxx, maxy
  
      Notes:
          path for hazard, exposure, and aggregation are relative to scenario
          file path