def METHOD_NAME(name, checksum_func=None):
    """
    Calculate "checksum" of content in a file or directory called "name".
    By default, the "checksum" is MD5 checksum. This can modified by "impl",
    which should be a function with the interface:
        checksum_str = checksum_func(source_str)
    Return a list of 3-element tuples. Each tuple represents a path in "name",
    the checksum, and the access mode. If the path is a directory, the checksum
    and the access mode will both be set to None.
    If "name" is a file, it returns a one-element list with a
    ("", checksum, mode) tuple.
    If "name" does not exist, raise OSError.
    """
    if not os.path.exists(name):
        raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), name)
    if checksum_func is None:
        checksum_func = get_checksum_func()
    path_and_checksum_list = []
    if os.path.isfile(name):
        checksum = checksum_func(name, "")
        path_and_checksum_list.append(
            ("", checksum, os.stat(os.path.realpath(name)).st_mode)
        )
    else:  # if os.path.isdir(path):
        name = os.path.normpath(name)
        path_and_checksum_list = []
        for dirpath, _, filenames in os.walk(name):
            path = dirpath[len(name) + 1 :]
            path_and_checksum_list.append((path, None, None))
            for filename in filenames:
                filepath = os.path.join(path, filename)
                source = os.path.join(name, filepath)
                checksum = checksum_func(source, name)
                mode = os.stat(os.path.realpath(source)).st_mode
                path_and_checksum_list.append((filepath, checksum, mode))
    return path_and_checksum_list