def _create_workdir_shared(workdir, args, parallel, tmpdir=None):
    """Create a work directory given inputs from the shared filesystem.

    If tmpdir is not None, we create a local working directory within the
    temporary space so IO and processing occurs there, remapping the input
    argument paths at needed.
    """
    if not tmpdir:
        return workdir, {}, args
    else:
        new_workdir = utils.safe_makedir(os.path.join(tmpdir, "bcbio-work-%s" % uuid.uuid1()))
        remap_dict = _remap_dict_shared(workdir, new_workdir, args)
        new_args = remap.walk_files(args, _remap_copy_file(parallel), remap_dict)
        return new_workdir, remap_dict, new_args
dataset/ETHPy150Open chapmanb/bcbio-nextgen-vm/bcbiovm/ship/reconstitute.py/_create_workdir_shared/original