<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def assemble(input_):
 """ Assembles input string, and leave the result in the MEMORY global object """

    global MEMORY

    if MEMORY is None:
        MEMORY = Memory()

    parser.parse(input_, lexer=LEXER, debug=OPTIONS.Debug.value > 2)
    if len(MEMORY.scopes):
        error(MEMORY.scopes[-1], 'Missing ENDP to close this scope')

    return gl.has_errors