def validate_same_rank(cards):
    """
    validate 3 of a kind or 4 of a kind
    :param cards: list of Card objects
    :return: Boolean
    """
    if len(cards) not in (3, 4):
        return False
    return all(card.rank == cards[0].rank for card in cards)