def to_base(n, base):
    """Transforms an integer to another defined base."""
    len_base = len(base)
    if n < len_base:
        return base[n]
    else:
        return to_base(n // len_base, base) + base[n % len_base]