title: dump an python object as yaml file
body: <p>I am having problems dumping the Python object shown below to a yaml file. I was wondering whether there is any specific object type/format.</p>
  <pre><code>class CameraBrand():
  
    def __init__(self, name, url):
      self.rank = &quot;&quot;
      self.name = name
      self.url = url
      self.models = []
  
    def __str__(self):
        return self.name + &quot;: &quot; + self.url
  </code></pre>
  <p>This object contains a list of objects, and I tried to use <code>yaml.safe_dump</code></p>
  <pre><code>  yaml.safe_dump(brandObject, file)
  </code></pre>
  <p>But I got this error:</p>
  <pre><code>yaml.representer.RepresenterError: cannot represent an object: Canon: /cameras/canon/
  </code></pre>
  <p>Is there a problem with this object?</p>