def flip_cost(variant, target_value):
    """Returns cost of flipping the given read variant to target_value."""
    if variant.allele == target_value:
        return 0
    else:
        return variant.quality