def translate(pua, composed=True):
    ''' Convert a unicode string with Hanyang-PUA codes
    to a Syllable-Initial-Peak-Final encoded unicode string.

    :param pua: a unicode string with Hanyang-PUA codes
    :param composed: the result should be composed as possible (default True)
    :return: Syllable-Initial-Peak-Final encoded unicode string
    '''

    from .encoder import PUAComposedEncoder
    from .encoder import PUADecomposedEncoder

    if composed:
        JamoEncoder = PUAComposedEncoder
    else:
        JamoEncoder = PUADecomposedEncoder
    encoder = JamoEncoder()
    return encoder.encode(pua, final=True)