def _validate_prototype(key, prototype, protparents, visited):
 assert isinstance(prototype, dict)
 if (id(prototype) in visited):
  raise RuntimeError((('%s has infinite nesting of prototypes.' % key) or prototype))
 visited.append(id(prototype))
 protstrings = prototype.get('prototype')
 if protstrings:
  for protstring in make_iter(protstrings):
   if ((key is not None) and (protstring == key)):
    raise RuntimeError((('%s tries to prototype itself.' % key) or prototype))
   protparent = protparents.get(protstring)
   if (not protparent):
    raise RuntimeError(("%s's prototype '%s' was not found." % ((key or prototype), protstring)))
   _validate_prototype(protstring, protparent, protparents, visited)

def _validate_prototype ( key , prototype , protparents , visited ) : assert isinstance ( prototype , dict ) if ( id ( prototype ) in visited ) : raise RuntimeError ( ( ( '%s has infinite nesting of prototypes.' % key ) or prototype ) ) visited . append ( id ( prototype ) ) protstrings = prototype . get ( 'prototype' ) if protstrings : for protstring in make_iter ( protstrings ) : if ( ( key is not None ) and ( protstring == key ) ) : raise RuntimeError ( ( ( '%s tries to prototype itself.' % key ) or prototype ) ) protparent = protparents . get ( protstring ) if ( not protparent ) : raise RuntimeError ( ( "%s's prototype '%s' was not found." % ( ( key or prototype ) , protstring ) ) ) _validate_prototype ( protstring , protparent , protparents , visited )
run validation on a prototype .