code: def extract_trios(family):
      
      self_key = ["ChildSelf"]
      keys = family.keys()
      spouse_key = [x for x in keys if ("spouse" in x.lower())]
      assert len(spouse_key) <= 1
      parent_keys = [x for x in keys if \
                      ("parent" in x.lower()) and ("grand" not in x.lower())]
      sib_keys = [x for x in keys if ("sibling" in x.lower()) \
                      or ("twin" in x.lower())] + self_key
      child_keys  = [x for x in keys if \
                      ("child"  in x.lower()) and ("grand" not in x.lower()) \
                      and ("self" not in x.lower())]
  
      for sk in sib_keys:
          yield TrioOrDuo(parent_keys, [sk], family)
      for ck in child_keys:
          yield TrioOrDuo(self_key + spouse_key, [ck], family)
docs: Identify all trios/duos inside a family, where a family contains dictionary
      of relationship: individual, for example:
        {
  	"ChildSelf": "176531498",
  	"DzTwin": "176531497",
  	"Parent": "176449143"
        }