title: Two levels deep one-to-many relationship with contains()
body: <p>I have two tables like so</p>
  
  <pre><code>class Department(Model):
      id = Column(Integer, primary_key=True)
      employees = relationship('Employee', backref='department')
  
  class Employee(Model):
      id = Column(Integer, primary_key=True)
      name = Column(String)
      department_id = Column(Integer, ForeignKey('department.id'))
      email_addresses = relationship('EmailAddress', backref='employee')
  
  class EmailAddress(Model):
      id = Column(Integer, primary_key=True)
      value = Column(String)
      employee_id = Column(Integer, ForeignKey('employee.id'))
  </code></pre>
  
  <p>And now I need to find all departments that have an employee with an email address of X.</p>
  
  <p>Back when each employee was allowed to have only one email address (so they had <code>email_address = Column(String)</code> I used this code, but I'm not sure how to extend it to work with multiple emails:</p>
  
  <pre><code>session.query(Department).filter(
      Employee.email_address==request.args['email']
  ).outerjoin((Employee, Department.employees))
  </code></pre>