def obj_from_id(resource_config, resources, typename):
    if "id" in resource_config:
        matching = [resource for resource in resources
                    if resource.id == resource_config["id"]]
        if len(matching) == 1:
            return matching[0]
        elif len(matching) > 1:
            raise exceptions.MultipleMatchesFound(
                needle="{typename} with id '{id}'".format(
                    typename=typename.title(), id=resource_config["id"]),
                haystack=matching)
        else:
            raise exceptions.InvalidScenarioArgument(
                "{typename} with id '{id}' not found".format(
                    typename=typename.title(), id=resource_config["id"]))
    else:
        raise exceptions.InvalidScenarioArgument(
            "{typename} 'id' not found in '{resource_config}'".format(
                typename=typename.title(), resource_config=resource_config))
Simple proof that a Commitment c = Com(m,r) is either 0 or 1
dataset/ETHPy150Open openstack/rally/rally/task/types.py/obj_from_id--crossover with--dataset/ETHPy150Open gdanezis/petlib/examples/GK15ringsig.py/ProveZeroOne