def create_tree_from_coverage(cov, strip_prefix=None, path_aliases=None, cover=[], exclude=[]):
    """Create a tree with coverage statistics.

    Takes a coverage.coverage() instance.

    Returns the root node of the tree.
    """
    root = CoverageNode()
    if path_aliases:
        apply_path_aliases(cov, dict([alias.partition('=')[::2]
                                      for alias in path_aliases]))
    for filename in cov.data.measured_files():
        if not any(pattern in filename.replace('/', '.') for pattern in cover):
            continue
        if any(pattern in filename.replace('/', '.') for pattern in exclude):
            continue

        if strip_prefix and filename.startswith(strip_prefix):
            short_name = filename[len(strip_prefix):]
            short_name = short_name.replace('/', os.path.sep)
            short_name = short_name.lstrip(os.path.sep)
        else:
            short_name = cov.file_locator.relative_filename(filename)
        tree_index = filename_to_list(short_name.replace(os.path.sep, '.'))
        if 'tests' in tree_index or 'ftests' in tree_index:
            continue
        root.set_at(tree_index, CoverageCoverageNode(cov, filename))
    return root
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/test/coveragereport.py/create_tree_from_coverage/original