def assert_valid_codeobj(allowed_codes, code_obj, expr):
 assert_no_dunder_name(code_obj, expr)
 if (set(_get_opcodes(code_obj)) - allowed_codes):
  raise ValueError(('forbidden opcode(s) in %r' % expr))
 for const in code_obj.co_consts:
  if isinstance(const, CodeType):
   assert_valid_codeobj(allowed_codes, const, 'lambda')

def assert_valid_codeobj ( allowed_codes , code_obj , expr ) : assert_no_dunder_name ( code_obj , expr ) if ( set ( _get_opcodes ( code_obj ) ) - allowed_codes ) : raise ValueError ( ( 'forbidden opcode(s) in %r' % expr ) ) for const in code_obj . co_consts : if isinstance ( const , CodeType ) : assert_valid_codeobj ( allowed_codes , const , 'lambda' )
asserts that the provided code object validates against the bytecode and name constraints .