def requires(resource, msg=None):
if resource == '<STR_LIT>' and not _is_gui_available():<EOL><INDENT>raise unittest.SkipTest("<STR_LIT>")<EOL><DEDENT>if sys._getframe(<NUM_LIT:1>).f_globals.get("<STR_LIT>") == "<STR_LIT:__main__>":<EOL><INDENT>return<EOL><DEDENT>if not is_resource_enabled(resource):<EOL><INDENT>if msg is None:<EOL><INDENT>msg = "<STR_LIT>" % resource<EOL><DEDENT>raise ResourceDenied(msg)<EOL><DEDENT>
Raise ResourceDenied if the specified resource is not available.

    If the caller's module is __main__ then automatically return True.  The
    possibility of False being returned occurs when regrtest.py is
    executing.