For a rules-oriented utility similar to logic evaluated in Guidewire PolicyCenter, implement a comparator for two five-card poker hands. Return 1 if the first hand wins, -1 if the second hand wins, and 0 if they are tied.
Cards are strings such as "AS", "10H", or "7C". The rank is one of 2 through 10, J, Q, K, or A; the final character is the suit. Evaluate hands using standard poker rankings, from highest to lowest: straight flush, four of a kind, full house, flush, straight, three of a kind, two pairs, one pair, and high card. Apply standard tie-breakers within the same category. An ace may be low only in the straight A-2-3-4-5.
Implement compare_hands(hand1, hand2), where each argument is a list of exactly five unique card strings. Return an integer in {-1, 0, 1}.
def compare_hands(hand1, hand2):