Fix Python – How to convert an integer to a string in any base?

Python allows easy creation of an integer from a string of a given base via
int(str, base).

I want to perform the inverse: creation of a string from an integer,
i.e. I want some function int2base(num, base), such that:
int(int2base(x, b), b) == x

The function name/argument order is unimportant.
For any number x and base b that int() will acc….