def reflink(path, dest, replace=False, fallback=False):
    """Create a reflink from `dest` to `path`.

    Raise an `OSError` if `dest` already exists, unless `replace` is
    True. If `path` == `dest`, then do nothing.

    If reflinking fails and `fallback` is enabled, try copying the file
    instead. Otherwise, raise an error without trying a plain copy.

    May raise an `ImportError` if the `reflink` module is not available.
    """
    import reflink as pyreflink

    if samefile(path, dest):
        return

    if os.path.exists(syspath(dest)) and not replace:
        raise FilesystemError('file exists', 'rename', (path, dest))

    try:
        pyreflink.reflink(path, dest)
    except (NotImplementedError, pyreflink.ReflinkImpossibleError):
        if fallback:
            copy(path, dest, replace)
        else:
            raise FilesystemError('OS/filesystem does not support reflinks.',
                                  'link', (path, dest), traceback.format_exc())