Help - form multi value replace

This old script no longer works with ver 3.
if “login.xyz.com” in flow.request.headers[“host”] :
form = flow.request.get_form_urlencoded()
if form[“SSN”][0].lower() == fake_id.lower() and form[“PIN”][0].lower() == fake_pwd.lower():
form[“username”] = [“user1”]
form[“password”] = [“pwd1”]
flow.request.set_form_urlencoded(form)

Any help?