Walk the file tree and query the file.stat object(s) to compute their total (or individual) size in bytes

    Returns:
      dict: {relative_path: file_size_in_bytes, ...}

    Examples:
      >>> all(d >= 0 for d in path_size(__file__).values())
      True
      >>> sum(path_size(os.path.dirname(__file__)).values()) == path_size(os.path.dirname(__file__), total=True)
      True
      >>> path_size(__file__, total=True) > 10000
      True
      >>> len(path_size('.')) >= 2
      True

def path_size(path, total=False, ext='', level=None, verbosity=0):
    """Walk the file tree and query the file.stat object(s) to compute their total (or individual) size in bytes

    Returns:
      dict: {relative_path: file_size_in_bytes, ...}

    Examples:
      >>> all(d >= 0 for d in path_size(__file__).values())
      True
      >>> sum(path_size(os.path.dirname(__file__)).values()) == path_size(os.path.dirname(__file__), total=True)
      True
      >>> path_size(__file__, total=True) > 10000
      True
      >>> len(path_size('.')) >= 2
      True
    """
    dict_of_path_sizes = dict((d['path'], d['size']) for d in util.find_files(path, ext=ext, level=level, verbosity=0))
    if total:
        return reduce(lambda tot, size: tot + size, dict_of_path_sizes.values(), 0)
    return dict_of_path_sizes