def generate_checks(fact):
    """Given a fact, generate a list of Check objects for checking it."""

    yield TypeCheck(type(fact))

    fact_captured = False
    for key, value in fact.items():
        if (isinstance(key, str)
                and key.startswith('__')
                and key.endswith('__')):
            # Special fact feature
            if key == '__bind__':
                yield FactCapture(value)
                fact_captured = True
            else:  # pragma: no cover
                yield FeatureCheck(key, value)
        else:
            yield FeatureCheck(key, value)

    # Assign the matching fact to the context
    if not fact_captured:
        yield FactCapture("__pattern_%s__" % id(fact))
Given a fact, generate a list of Check objects for checking it.