# Buggy code
def execute(args, parser):
    prefix = context.prefix_w_legacy_search
    regex = args.regex
    if args.full_name:
        regex = r"^%s$" % regex

    if args.revisions:
        from ..history import History

        h = History(prefix)
        if isfile(h.path):
            if not context.json:
                h.print_log()
            else:
                stdout_json(h.object_log())
        else:
            raise CondaFileNotFoundError(h.path)
        return

    if args.explicit:
        print_explicit(prefix, args.md5)
        return

    if args.canonical:
        format = "canonical"
    elif args.export:
        format = "export"
    else:
        format = "human"
    if context.json:
        format = "canonical"

    exitcode = print_packages(
        prefix,
        regex,
        format,
        piplist=args.pip,
        json=context.json,
        show_channel_urls=context.show_channel_urls,
    )
    return exitcode


# Traceback (ImportError)
Traceback (most recent call last):
File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 573, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 98, in _main
imported = importlib.import_module(module)
File "/Users/tasalta/anaconda/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/cli/main_list.py", line 20, in <module>
from ..egg_info import get_egg_info
File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/egg_info.py", line 15, in <module>
from .misc import rel_path
File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/misc.py", line 19, in <module>
from .core.index import get_index, _supplement_index_with_cache
File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module>
from .repodata import collect_all_repodata
File "/Users/tasalta/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module>
from requests.packages.urllib3.exceptions import InsecureRequestWarning
ImportError: cannot import name InsecureRequestWarning


at throwCondaError (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/utils/conda.js:117:9)
at runConda (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/utils/conda.js:146:5)
at Object.info (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/utils/conda.js:395:10)
at Object.isGLCLauncherReady (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/utils/systemState.js:207:27)
at [object Object].onWindowOpen [as _onTimeout] (/Applications/GraphLab Create Launcher.app/Contents/Resources/app.asar/main.js:144:57)
at Timer.listOnTimeout (timers.js:89:15)

# Fixed code
def execute(args, parser):
    from ..base.context import context
    from .common import stdout_json

    prefix = context.prefix_w_legacy_search
    regex = args.regex
    if args.full_name:
        regex = r"^%s$" % regex

    if args.revisions:
        from ..history import History

        h = History(prefix)
        if isfile(h.path):
            if not context.json:
                h.print_log()
            else:
                stdout_json(h.object_log())
        else:
            from ..exceptions import CondaFileNotFoundError

            raise CondaFileNotFoundError(h.path)
        return

    if args.explicit:
        print_explicit(prefix, args.md5)
        return

    if args.canonical:
        format = "canonical"
    elif args.export:
        format = "export"
    else:
        format = "human"
    if context.json:
        format = "canonical"

    exitcode = print_packages(
        prefix,
        regex,
        format,
        piplist=args.pip,
        json=context.json,
        show_channel_urls=context.show_channel_urls,
    )
    return exitcode