Return ``True`` if a file can be written at the given ``path``.

    :param string path: the file path
    :rtype: bool

    .. warning:: This function will attempt to open the given ``path``
                 in write mode, possibly destroying the file previously existing there.

    .. versionadded:: 1.4.0

def file_can_be_written(path):
    """
    Return ``True`` if a file can be written at the given ``path``.

    :param string path: the file path
    :rtype: bool

    .. warning:: This function will attempt to open the given ``path``
                 in write mode, possibly destroying the file previously existing there.

    .. versionadded:: 1.4.0
    """
    if path is None:
        return False
    try:
        with io.open(path, "wb") as test_file:
            pass
        delete_file(None, path)
        return True
    except (IOError, OSError):
        pass
    return False