Python Counter Method Time Complexity