from itertools import groupby

def sequences(data):
	# [1, 3, 4, 6] -> [1], [3, 4], [6]
    data = sorted(data)
    for _, g in groupby(enumerate(data), lambda x: x[0] - x[1]):
        yield [v for _,v in g]
    
def has_straight(cards):
    # Straight is a sequence of 5 cards or 4 cards + Ace!
    ranks = {card for card in cards}
    required = 4 if 1 in ranks else 5
    return len(ranks) >= 5 and any(len(x) >= required for x in sequences(ranks))

print(has_straight([1, 2, 3, 4, 5]))
print(has_straight([1, 6, 3, 4, 5]))
print(has_straight([3, 4, 5, 6, 7]))

print(has_straight([3, 4, 5, 6, 8]))
print(has_straight([1, 10, 3, 4, 5]))
print(has_straight([]))
print(has_straight([1, 2, 3, 4]))
print(has_straight([1, 1, 2, 3]))
print(has_straight([1, 1, 2, 3, 4])) # должно ли тут быть true?