<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def magicrun( text, shell, prompt_template="default", aliases=None, envvars=None, extra_commands=None, speed=1, test_mode=False, commentecho=False, ):
 """Echo out each character in ``text`` as keyboard characters are pressed, wait for a RETURN keypress, then run the ``text`` in a shell context. """

    goto_regulartype = magictype(text, prompt_template, speed)
    if goto_regulartype:
        return goto_regulartype
    run_command(
        text,
        shell,
        aliases=aliases,
        envvars=envvars,
        extra_commands=extra_commands,
        test_mode=test_mode,
    )
    return goto_regulartype