
R-mahjong ⅠⅠ: is hand winning?

The second part of the series dedicated to the Japanese game "riichi mahjong". It's a little more complicated than the previous one.
Your task is to check if the hand is a winning one. If in the previous mission you were given a ready-made hand, then in this one there will be just a set of tiles in the input data, which may not be victorious.
Let me remind you of the conditions of victory.
- There should be exactly 14 tiles in the hand.
- The hand must contain four sets (pon or chi) and one pair.
In this mission, the second argument of the function is added — a list of so-called open sets. Such a set in the game is created by taking away a tile that the opponent discarded as unnecessary. The set that was supplemented with this tile is put aside and does not change anymore. Note that pairs cannot be open.
Each of the open sets needs to be checked whether it is valid or not. For example, 's456' is a valid set, and 'm124' or 'p11' is invalid.
One more note: there are exceptions to the second victory condition. There are two types of hands that can be winning and at the same time not contain four sets and a pair (in a real game, these hands are quite rare). Here they are:
- Chitoisu. Hand, that contains seven pairs. For example:
['p1', 'p1', 'p5', 'p5', 'm2', 'm2', 'm6', 'm6', 's3', 's3', 's9', 's9', 'ww', 'ww']
Note, that there should not be two identical pairs in the hand.
['m1', 'm9', 'p1', 'p1', 'p9', 's1', 's9', 'wn', 'we', 'ws', 'ww', 'dg', 'dr', 'dw']
Input data: Two arguments of the list type: the first is strings encoding tiles, the second is strings encoding open sets (may be empty).
Output data: One variable of the bool type: the answer to the question "is the hand ready?".
Example:
riichi_mahjong_win_hand(['m1', 'm2', 'm3', 'm5', 'm5', 'p2', 'p3', 'p4', 'p7', 'p8', 'p9'], ['s456']) == True