<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def acp_account():
 """Manage the user account of currently-logged-in users. This does NOT accept admin-specific options. """

    if request.args.get('status') == 'pwdchange':
        alert = 'You must change your password before proceeding.'
        alert_status = 'danger'
        pwdchange_skip = True
    else:
        alert = ''
        alert_status = ''
        pwdchange_skip = False

    if db is None:
        form = PwdHashForm()
        return render('coil_account_single.tmpl',
                      context={'title': 'My account',
                               'form': form,
                               'alert': alert,
                               'alert_status': alert_status})

    action = 'edit'
    form = AccountForm()
    if request.method == 'POST':
        if int(current_user.uid) in app.config['COIL_USERS_PREVENT_EDITING']:
            return error("Cannot edit data for this user.", 403)
        if not form.validate():
            return error("Bad Request", 400)
        action = 'save'
        data = request.form
        if data['newpwd1']:
            try:
                pwd_ok = check_password(current_user.password, data['oldpwd'])
            except ValueError:
                if current_user.password.startswith('$2a$12'):
                    # old bcrypt hash
                    pwd_ok = check_old_password(current_user.password,
                                                data['oldpwd'])

            if data['newpwd1'] == data['newpwd2'] and pwd_ok:
                current_user.password = password_hash(data['newpwd1'])
                current_user.must_change_password = False
                pwdchange_skip = True
            else:
                alert = 'Passwords don’t match.'
                alert_status = 'danger'
                action = 'save_fail'
        current_user.realname = data['realname']
        current_user.email = data['email']
        current_user.wants_all_posts = 'wants_all_posts' in data
        write_user(current_user)

    return render('coil_account.tmpl',
                  context={'title': 'My account',
                           'action': action,
                           'alert': alert,
                           'alert_status': alert_status,
                           'form': form,
                           'pwdchange_skip': pwdchange_skip})