Create an "INSTANCEOF" Filter from a CoerceType, adding to an existing Filter if any.

def convert_coerce_type_and_add_to_where_block(coerce_type_block, where_block):
    """Create an "INSTANCEOF" Filter from a CoerceType, adding to an existing Filter if any."""
    instanceof_filter = convert_coerce_type_to_instanceof_filter(coerce_type_block)

    if where_block:
        # There was already a Filter block -- we'll merge the two predicates together.
        return Filter(BinaryComposition(u'&&', instanceof_filter.predicate, where_block.predicate))
    else:
        return instanceof_filter