# Path: muninn/_compat.py
# PY3 = sys.version_info[0] == 3
#     def is_python2_unicode(x):
#     def dictkeys(d):
#     def dictvalues(d):
#     def path_utf8(path):
#     def encode(s):
#     def decode(s):
#     def is_python2_unicode(x):
#     def path_utf8(path):
#     def decode(s):
#     def encode(s):
# 
# Path: muninn/_compat.py
# def path_utf8(path):
#     return path.encode('utf-8')
# 
# def encode(s):
#     return s.encode('utf-8')
# 
# def decode(s):
#     return s.decode('utf-8')


import errno
import hashlib
import os
import shutil
import tempfile
from muninn._compat import string_types as basestring
from muninn._compat import path_utf8, encode, decode
    for root in sorted(roots):
        hash.update(hash_string(path_utf8(os.path.basename(root)), hash_func))

        if os.path.islink(root) and not (resolve_root or resolve_links):
            hash.update(b"l")
        elif os.path.isdir(root):
            hash.update(b"d")
        else:
            hash.update(b"f")

        hash.update(_product_hash_rec(root, resolve_root, resolve_links, hash_func, block_size))

    return hash_type + ':' + hash.hexdigest()


def product_size(roots, resolve_root=True, resolve_links=False):
    def _product_size_rec(root, resolve_root, resolve_links):
        if os.path.islink(root) and not (resolve_root or resolve_links):
            # Use size of the symbolic link itself (instead of the size of its target).
            return os.lstat(root).st_size

        elif os.path.isfile(root):
            return os.stat(root).st_size

        elif os.path.isdir(root):
            return sum([_product_size_rec(os.path.join(root, base), False, resolve_links) for base in os.listdir(root)])

        else:
            raise IOError("path does not refer to a regular file or directory: %s" % root)


# Path: muninn/_compat.py
# PY3 = sys.version_info[0] == 3
#     def is_python2_unicode(x):
#     def dictkeys(d):
#     def dictvalues(d):
#     def path_utf8(path):
#     def encode(s):
#     def decode(s):
#     def is_python2_unicode(x):
#     def path_utf8(path):
#     def decode(s):
#     def encode(s):
# 
# Path: muninn/_compat.py
# def path_utf8(path):
#     return path.encode('utf-8')
# 
# def encode(s):
#     return s.encode('utf-8')
# 
# def decode(s):
#     return s.decode('utf-8')


# Path: muninn/util.py
import errno
import hashlib
import os
import shutil
import tempfile
from muninn._compat import string_types as basestring
from muninn._compat import path_utf8, encode, decode

    for root in sorted(roots):
        hash.update(hash_string(path_utf8(os.path.basename(root)), hash_func))

        if os.path.islink(root) and not (resolve_root or resolve_links):
            hash.update(b"l")
        elif os.path.isdir(root):
            hash.update(b"d")
        else:
            hash.update(b"f")

        hash.update(_product_hash_rec(root, resolve_root, resolve_links, hash_func, block_size))

    return hash_type + ':' + hash.hexdigest()


def product_size(roots, resolve_root=True, resolve_links=False):
    def _product_size_rec(root, resolve_root, resolve_links):
        if os.path.islink(root) and not (resolve_root or resolve_links):
            # Use size of the symbolic link itself (instead of the size of its target).
            return os.lstat(root).st_size

        elif os.path.isfile(root):
            return os.stat(root).st_size

        elif os.path.isdir(root):
            return sum([_product_size_rec(os.path.join(root, base), False, resolve_links) for base in os.listdir(root)])

        else:
            raise IOError("path does not refer to a regular file or directory: %s" % root)


    if isinstance(roots, basestring):