import string


def base_encode(number, alphabet=string.ascii_lowercase, fill=None):
    """Encode a number in an arbitrary base, by default, base 26. """

    b = ''

    while number:
        number, i = divmod(number, len(alphabet))
        b = alphabet[i] + b


    v = b or alphabet[0]

    if fill:
        return (alphabet[0]*(fill-len(v)))+v
    else:
        return v