code: def grains_dict(self):
          
          d = {grain.duration: grain for grain in self.grains()}
          d.update({grain.label: grain for grain in self.grains()})
          return d
docs: Allowing to lookup grain by either label or duration
  
          For backward compatibility