def check_dyad(w, w_dyad):
 if (not (is_weight(w) and is_dyad_weight(w_dyad))):
  return False
 if (w == w_dyad):
  return True
 if (len(w_dyad) == (len(w) + 1)):
  return (w == tuple((Fraction(v, (1 - w_dyad[(-1)])) for v in w_dyad[:(-1)])))
 else:
  return False

def check_dyad ( w , w_dyad ) : if ( not ( is_weight ( w ) and is_dyad_weight ( w_dyad ) ) ) : return False if ( w == w_dyad ) : return True if ( len ( w_dyad ) == ( len ( w ) + 1 ) ) : return ( w == tuple ( ( Fraction ( v , ( 1 - w_dyad [ ( - 1 ) ] ) ) for v in w_dyad [ : ( - 1 ) ] ) ) ) else : return False
check that w_dyad is a valid dyadic completion of w .