Python assignment to determine Ancestry of bears and then bears with common Ancestry