def dir_visitor(dirname, visitor):
    """
    _dir_visitor_

    walk through all files in dirname, find
    directories and call the callable on them.

    :param dirname: Name of directory to start visiting,
      all subdirs will be visited
    :param visitor: Callable invoked on each dir visited
    """
    visitor(dirname)
    for obj in os.listdir(dirname):
        obj_path = os.path.join(dirname, obj)
        if os.path.isdir(obj_path):
            dir_visitor(obj_path, visitor)