def compose(text, compose_code=DEFAULT_COMPOSE_SEPARATOR):
    from .const import ONSET, NUCLEUS, CODA
    from . import letter
    res_text = ''
    status = STATUS_CHO
    for c in text:
        if (status == STATUS_CHO):
            if (c in ONSET):
                chosung = c
                status = STATUS_JOONG
            elif (c != compose_code):
                res_text = (res_text + c)
        elif (status == STATUS_JOONG):
            if ((c != compose_code) and (c in NUCLEUS)):
                joongsung = c
                status = STATUS_JONG1
            else:
                res_text = (res_text + chosung)
                if (c in ONSET):
                    chosung = c
                    status = STATUS_JOONG
                else:
                    if (c != compose_code):
                        res_text = (res_text + c)
                    status = STATUS_CHO
        elif (status == STATUS_JONG1):
            if ((c != compose_code) and (c in CODA)):
                jongsung = c
                if (c in JONG_COMP):
                    status = STATUS_JONG2
                else:
                    res_text = (res_text + letter.compose(chosung, joongsung, jongsung))
                    status = STATUS_CHO
            else:
                res_text = (res_text + letter.compose(chosung, joongsung))
                if (c in ONSET):
                    chosung = c
                    status = STATUS_JOONG
                else:
                    if (c != compose_code):
                        res_text = (res_text + c)
                    status = STATUS_CHO
        elif (status == STATUS_JONG2):
            if ((c != compose_code) and (c in JONG_COMP[jongsung])):
                jongsung = JONG_COMP[jongsung][c]
                c = compose_code
            res_text = (res_text + letter.compose(chosung, joongsung, jongsung))
            if (c != compose_code):
                res_text = (res_text + c)
            status = STATUS_CHO
    return res_text
def compose(text, compose_code=DEFAULT_COMPOSE_SEPARATOR):
    from .const import ONSET, NUCLEUS, CODA
    from . import letter
    res_text = 
    status = STATUS_CHO
    for c in text:
        if (status == STATUS_CHO):
            if (c in ONSET):
                chosung = c
                status = STATUS_JOONG
            elif (c != compose_code):
                res_text = (res_text + c)
        elif (status == STATUS_JOONG):
            if ((c != compose_code) and (c in NUCLEUS)):
                joongsung = c
                status = STATUS_JONG1
            else:
                res_text = (res_text + chosung)
                if (c in ONSET):
                    chosung = c
                    status = STATUS_JOONG
                else:
                    if (c != compose_code):
                        res_text = (res_text + c)
                    status = STATUS_CHO
        elif (status == STATUS_JONG1):
            if ((c != compose_code) and (c in CODA)):
                jongsung = c
                if (c in JONG_COMP):
                    status = STATUS_JONG2
                else:
                    res_text = (res_text + letter.compose(chosung, joongsung, jongsung))
                    status = STATUS_CHO
            else:
                res_text = (res_text + letter.compose(chosung, joongsung))
                if (c in ONSET):
                    chosung = c
                    status = STATUS_JOONG
                else:
                    if (c != compose_code):
                        res_text = (res_text + c)
                    status = STATUS_CHO
        elif (status == STATUS_JONG2):
            if ((c != compose_code) and (c in JONG_COMP[jongsung])):
                jongsung = JONG_COMP[jongsung][c]
                c = compose_code
            res_text = (res_text + letter.compose(chosung, joongsung, jongsung))
            if (c != compose_code):
                res_text = (res_text + c)
            status = STATUS_CHO
    return res_text