<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _to_cwlfile_with_indexes(val, get_retriever):
 """Convert reads with ready to go indexes into the right CWL object. Identifies the top level directory and creates a tarball, avoiding trying to handle complex secondary setups which are not cross platform. Skips doing this for reference files and standard setups like bwa, which take up too much time and space to unpack multiple times. """

    val["indexes"] = _index_blacklist(val["indexes"])
    tval = {"base": _remove_remote_prefix(val["base"]),
            "indexes": [_remove_remote_prefix(f) for f in val["indexes"]]}
    # Standard named set of indices, like bwa
    # Do not include snpEff, which we need to isolate inside a nested directory
    # hisat2 indices do also not localize cleanly due to compilicated naming
    cp_dir, cp_base = os.path.split(os.path.commonprefix([tval["base"]] + tval["indexes"]))
    if (cp_base and cp_dir == os.path.dirname(tval["base"]) and
            not ("/snpeff/" in cp_dir or "/hisat2" in cp_dir)):
        return _item_to_cwldata(val["base"], get_retriever, val["indexes"])
    else:
        dirname = os.path.dirname(tval["base"])
        assert all([x.startswith(dirname) for x in tval["indexes"]])
        return {"class": "File", "path": directory_tarball(dirname)}