def METHOD_NAME(src, dst):
    # Try atomic or pseudo-atomic rename
    if _rename(src, dst):
        return
    # Fall back to "move away and replace"
    try:
        os.rename(src, dst)
    except OSError as err:
        if err.errno != errno.EEXIST:
            raise
        old = "{}-{:08x}".format(dst, random.randint(0, sys.maxint))
        os.rename(dst, old)
        os.rename(src, dst)
        try:
            os.unlink(old)
        except Exception:  # pylint: disable=broad-except
            pass