from typing import Callable


def contains(substring: str, false_prob: float = 0.0,
             true_prob: float = 1.0) -> Callable:
    """Generate a function that checks whether a substring is present."""
    def call(value: object) -> float:
        if not isinstance(value, str):
            return 0.0
        return true_prob if substring in value else false_prob
    return call