def validate(interface, obj, members=[], meta=DEFAULT_META):
    invalid = []

    if hasattr(obj, '_meta') and interface != obj._meta.interface:
        raise exc.InterfaceError("%s does not implement %s." %
                                 (obj, interface))

    for member in members:
        if not hasattr(obj, member):
            invalid.append(member)

    if not hasattr(obj, '_meta'):
        invalid.append("_meta")
    else:
        for member in meta:
            if not hasattr(obj._meta, member):
                invalid.append("_meta.%s" % member)

    if invalid:
        raise exc.InterfaceError("Invalid or missing: %s in %s" %
                                 (invalid, obj))
A wrapper to validate interfaces.
dataset/ETHPy150Open datafolklabs/cement/cement/core/interface.py/validate