<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ensure_trafaret(trafaret):
 """ Helper for complex trafarets, takes trafaret instance or class and returns trafaret instance """

    if isinstance(trafaret, Trafaret):
        return trafaret
    elif isinstance(trafaret, type):
        if issubclass(trafaret, Trafaret):
            return trafaret()
        # str, int, float are classes, but its appropriate to use them
        # as trafaret functions
        return Call(lambda val: trafaret(val))
    elif callable(trafaret):
        return Call(trafaret)
    else:
        raise RuntimeError("%r should be instance or subclass"
                           " of Trafaret" % trafaret)