<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_app_state(app_id):
 """ get app state """

    try:
        conn = get_conn()
        c = conn.cursor()
        c.execute("SELECT state FROM app WHERE id='{0}' ".format(app_id))
        result = c.fetchone()
        conn.close()

        if result:
            state = result[0]
            return state
        else:
            return None

    except Exception,e:
        raise RuntimeError('get app state failed! %s' % e)