def itoa(num, base=10):
    """ Convert a decimal number to its equivalent in another base.
    This is essentially the inverse of int(num, base).
    """
    negative = num < 0
    if negative:
      num = -num
    digits = []
    while num > 0:
      num, last_digit = divmod(num, base)
      digits.append('0123456789abcdefghijklmnopqrstuvwxyz'[last_digit])
    if negative:
      digits.append('-')
    digits.reverse()
    return ''.join(digits)