title: InputFunctionException with KeyError
body: <p>Suppose I have a code in python that generates a dictionary as the result. I need to write each element of dictionary in a separate folder which later will be used by other set of rules in snakemake. 
  I have written the code as following but it does not work!</p>
  
  <pre><code>simulation_index_dict={1:'test1',2:'test2'}
  
  
  def indexer(wildcards):
      return(simulation_index_dict[wildcards.simulation_index])
  
  rule SimulateAll:
         input:
          expand("{simulation_index}/ProteinCodingGene/alfsim.drw",simulation_index=simulation_index_dict.keys())
  
  
  
  rule simulate_phylogeny:
      output:
          ProteinCodingGeneParams=expand("{{simulation_index}}/ProteinCodingGene/alfsim.drw"),
          IntergenicRegionParams=expand("{{simulation_index}}/IntergenicRegions/dawg_IR.dawg"),
          RNAGeneParams=expand("{{simulation_index}}/IntergenicRegions/dawg_RG.dawg"),
          RepeatRegionParams=expand("{{simulation_index}}/IntergenicRegions/dawg_RR.dawg"),
      params:
          value= indexer,
      shell:
          """
          echo {params.value} &gt; {output.ProteinCodingGeneParams}
          echo {params.value} &gt; {output.IntergenicRegionParams}
          echo {params.value} &gt; {output.RNAGeneParams}
          echo {params.value} &gt; {output.RepeatRegionParams}
          """
  </code></pre>
  
  <p>The error it return is :</p>
  
  <pre><code>InputFunctionException in line 14 of /$/test.snake:
  KeyError: '1'
  Wildcards:
  simulation_index=1
  </code></pre>
  
  <p>It seems that problems is with the params section of the rule because deleting it will eliminates the error but I can not figure out what is wrong with the params!</p>