def createFactoryCopy(state):
    """
    Factory of L{SimpleFactoryCopy}, getting a created instance given the
    C{id} found in C{state}.
    """
    stateId = state.get("id", None)
    if stateId is None:
        raise RuntimeError("factory copy state has no 'id' member %s" %
                           (repr(state),))
    if not stateId in SimpleFactoryCopy.allIDs:
        raise RuntimeError("factory class has no ID: %s" %
                           (SimpleFactoryCopy.allIDs,))
    inst = SimpleFactoryCopy.allIDs[stateId]
    if not inst:
        raise RuntimeError("factory method found no object with id")
    return inst
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/test/test_pb.py/createFactoryCopy/original