def _unpack_s3(bucket, args):
    """Create local directory in current directory with pulldowns from S3.
    """
    local_dir = utils.safe_makedir(os.path.join(os.getcwd(), bucket))
    remote_key = "s3://%s" % bucket
    def _get_s3(orig_fname, context, remap_dict):
        """Pull down s3 published data locally for processing.
        """
        if orig_fname.startswith(remote_key):
            if context[0] in ["reference", "genome_resources", "sam_ref"]:
                cur_dir = os.path.join(local_dir, "genomes")
            else:
                cur_dir = local_dir
            for fname in utils.file_plus_index(orig_fname):
                out_fname = fname.replace(remote_key, cur_dir)
                keyname = fname.replace(remote_key + "/", "")
                _transfer_s3(out_fname, keyname, bucket)
            return orig_fname.replace(remote_key, cur_dir)
        else:
            return orig_fname
    new_args = remap.walk_files(args, _get_s3, {remote_key: local_dir})
    return local_dir, new_args

# ## Shared filesystem
dataset/ETHPy150Open chapmanb/bcbio-nextgen-vm/bcbiovm/ship/reconstitute.py/_unpack_s3/original