Convert the specified integer to a key using the given base.

    @param value: a positive integer.

    @param base: a sequence of characters that is used to encode the
           integer value.

    @return: a key expressed in the specified base.

def int_to_key(value, base=BASE62):
    """
    Convert the specified integer to a key using the given base.

    @param value: a positive integer.

    @param base: a sequence of characters that is used to encode the
           integer value.

    @return: a key expressed in the specified base.
    """
    def key_sequence_generator(value, base):
        """
        Generator for producing sequence of characters of a key providing an
        integer value and a base of characters for encoding, such as Base62
        for instance.

        @param value: a positive integer.
        @param base: a sequence of characters that is used to encode the
               integer value.

        @return: the next character of the object's key encoded with the
                 specified base.
            """
        base_length = len(base)
        while True:
            yield base[value % base_length]
            if value < base_length:
                break
            value /= base_length

    return ''.join([ c for c in key_sequence_generator(value, base) ])