def alphatrans(plaintext, alpha1, alpha2):
    """
    Function for translation from a plaintext alphabet to a 
    codetext alphabet.

    Args:
    plaintext -- plaintext to be coded.
    alpha1 -- plaintext alphabet.
    alpha2 -- codetext alphabet.

    Returns:
    Coded text string.
    """
    alpha1 = alpha1.lower()
    alpha2 = alpha2.lower()
    plaintext = plaintext.lower()
    codetext = ''
    for char in plaintext:
        try:
            index = alpha1.index(char)
            codetext += alpha2[index].upper()
        except:
            codetext += char
    return codetext
