human
Complete the below
def _image_directories(func):

    ''''Compute the baseline and result image directories for testing *func*.
    Create the result directory if it doesn\'t exist.'
    '''
assistant
#Here is Python code to compute the baseline and result image directories for testing *func*.
    module_name = func.__module__
    if (module_name == u'__main__'):
        warnings.warn(u'test    module    run    as    script.    guessing    baseline    image    locations')
        script_name = sys.argv[0]
        basedir = os.path.abspath(os.path.dirname(script_name))
        subdir = os.path.splitext(os.path.split(script_name)[1])[0]
    else:
        mods = module_name.split(u'.')
        if (len(mods) >= 3):
            mods.pop(0)
        if (mods.pop(0) != u'tests'):
            warnings.warn((u"Module    '%s'    does    not    live    in    a    parent    module    named    'tests'.    This    is    probably    ok,    but    we    may    not    be    able    to    guess    the    correct    subdirectory    containing    the    baseline    images.    If    things    go    wrong    please    make    sure    that    there    is    a    parent    directory    named    'tests'    and    that    it    contains    a    __init__.py    file    (can    be    empty)." % module_name))
        subdir = os.path.join(*mods)
        import imp
        def find_dotted_module(module_name, path=None):
            u'A    version    of    imp    which    can    handle    dots    in    the    module    name.\n                                                            As    for    imp.find_module(),    the    return    value    is    a    3-element\n                                                            tuple    (file,    pathname,    description).'
            res = None
            for sub_mod in module_name.split(u'.'):
                try:
                    res = (file, path, _) = imp.find_module(sub_mod, path)
                    path = [path]
                    if (file is not None):
                        file.close()
                except ImportError:
                    path = list(sys.modules[sub_mod].__path__)
                    res = (None, path, None)
            return res
        mod_file = find_dotted_module(func.__module__)[1]
        basedir = os.path.dirname(mod_file)
    baseline_dir...