Copied over CPython's str.__mod__