def dump(data, hdfs_path, **kwargs):
    """\
    Write ``data`` to ``hdfs_path``.

    Keyword arguments are passed to :func:`open`, except for ``mode``,
    which is forced to ``"w"`` (or ``"wt"`` for text data).
    """
    kwargs["mode"] = "w" if isinstance(data, bintype) else "wt"
    with open(hdfs_path, **kwargs) as fo:
        i = 0
        bufsize = common.BUFSIZE
        while i < len(data):
            fo.write(data[i: i + bufsize])
            i += bufsize
    fo.fs.close()
\
    Write ``data`` to ``hdfs_path``.

    Keyword arguments are passed to :func:`open`, except for ``mode``,
    which is forced to ``"w"`` (or ``"wt"`` for text data).