def warn(message, category=None, stacklevel=<NUM_LIT:1>):
<EOL>if isinstance(message, Warning):<EOL><INDENT>category = message.__class__<EOL><DEDENT>if category is None:<EOL><INDENT>category = UserWarning<EOL><DEDENT>assert issubclass(category, Warning)<EOL>try:<EOL><INDENT>caller = sys._getframe(stacklevel)<EOL><DEDENT>except ValueError:<EOL><INDENT>globals = sys.__dict__<EOL>lineno = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>globals = caller.f_globals<EOL>lineno = caller.f_lineno<EOL><DEDENT>if '<STR_LIT>' in globals:<EOL><INDENT>module = globals['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>module = "<STR_LIT>"<EOL><DEDENT>filename = globals.get('<STR_LIT>')<EOL>if filename:<EOL><INDENT>fnl = filename.lower()<EOL>if fnl.endswith(("<STR_LIT>", "<STR_LIT>")):<EOL><INDENT>filename = filename[:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if module == "<STR_LIT:__main__>":<EOL><INDENT>try:<EOL><INDENT>filename = sys.argv[<NUM_LIT:0>]<EOL><DEDENT>except AttributeError:<EOL><INDENT>filename = '<STR_LIT:__main__>'<EOL><DEDENT><DEDENT>if not filename:<EOL><INDENT>filename = module<EOL><DEDENT><DEDENT>registry = globals.setdefault("<STR_LIT>", {})<EOL>warn_explicit(message, category, filename, lineno, module, registry,<EOL>globals)<EOL>
Issue a warning, or maybe ignore it or raise an exception.