def use_setuptools(<EOL>version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,<EOL>download_delay=<NUM_LIT:15><EOL>):
was_imported = '<STR_LIT>' in sys.modules or '<STR_LIT>' in sys.modules<EOL>def do_download():<EOL><INDENT>egg = download_setuptools(version, download_base, to_dir, download_delay)<EOL>sys.path.insert(<NUM_LIT:0>, egg)<EOL>import setuptools; setuptools.bootstrap_install_from = egg<EOL><DEDENT>try:<EOL><INDENT>import pkg_resources<EOL><DEDENT>except ImportError:<EOL><INDENT>return do_download()<EOL><DEDENT>try:<EOL><INDENT>pkg_resources.require("<STR_LIT>"+version); return<EOL><DEDENT>except pkg_resources.VersionConflict as e:<EOL><INDENT>if was_imported:<EOL><INDENT>print((<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>) % (version, e.args[<NUM_LIT:0>]), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:2>)<EOL><DEDENT>else:<EOL><INDENT>del pkg_resources, sys.modules['<STR_LIT>']    <EOL>return do_download()<EOL><DEDENT><DEDENT>except pkg_resources.DistributionNotFound:<EOL><INDENT>return do_download()<EOL><DEDENT>
Automatically find/download setuptools and make it available on sys.path

    `version` should be a valid setuptools version number that is available
    as an egg for download under the `download_base` URL (which should end with
    a '/').  `to_dir` is the directory where setuptools will be downloaded, if
    it is not already available.  If `download_delay` is specified, it should
    be the number of seconds that will be paused before initiating a download,
    should one be required.  If an older version of setuptools is installed,
    this routine will print a message to ``sys.stderr`` and raise SystemExit in
    an attempt to abort the calling script.