title: Deserializing YAML back into Python object
body: <p>I'm trying to write a correct <code>from_yaml</code> method to my class in order to be able to deserialize back to it when loading YAML file using <code>ruamel.yaml</code> library.</p>
  
  <p>Let's assume that in my <code>to_yaml</code> class method I'm returning something like:</p>
  
  <pre><code>@classmethod
  def to_yaml(cls, dumper, data):
      dict_representation = {
          'foo': data.foo, 
          'bar': data.bar
      }
  
      return dumper.represent_mapping(cls.yaml_tag, dict_representation)
  </code></pre>
  
  <p>Now in the deserialization method</p>
  
  <pre><code>@classmethod
  def from_yaml(cls, constructor, node):
      dict_representation = constructor.construct_mapping(node, deep=True)
  </code></pre>
  
  <p>With this I get the <code>TypeError</code>:</p>
  
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-6-782b00e19bec&gt; in &lt;module&gt;()
  ----&gt; 1 dict_representation = yaml.constructor.construct_mapping(node, deep=True)
  
  /home/**/.envs/myenv/local/lib/python2.7/site-packages/ruamel/yaml/constructor.pyc in construct_mapping(self, node, maptyp, deep)
     1186                         "found unhashable key", key_node.start_mark)
     1187             value = self.construct_object(value_node, deep=deep)
  -&gt; 1188             self.check_mapping_key(node, key_node, maptyp, key, value)
     1189
     1190             if key_node.comment and len(key_node.comment) &gt; 4 and \
  
  /home/**/.envs/myenv/local/lib/python2.7/site-packages/ruamel/yaml/constructor.pyc in check_mapping_key(self, node, key_node, mapping, key, value)
      241     def check_mapping_key(self, node, key_node, mapping, key, value):
      242         # type: (Any, Any, Any, Any, Any) -&gt; None
  --&gt; 243         if key in mapping:
      244             if not self.allow_duplicate_keys:
      245                 args = [
  
  TypeError: argument of type 'NoneType' is not iterable
  </code></pre>
  
  <p>In fact trying to do this more empirically, in an interactive shell:</p>
  
  <pre><code>import ruamel.yaml
  yaml = ruamel.yaml.YAML()
  dd = {'foo': 'foo'}
  node = yaml.representer.represent_mapping('!dd', dd)
  dict_representation = yaml.constructor.construct_mapping(node)
  </code></pre>
  
  <p>raises the same exception. What am I missing here?</p>