from bs4 import BeautifulSoup
import re


def parse_lxml_form(text):
    """ Parse lxml form into a dictionary of name:value based on the 'input' tags in text"""
    soup = BeautifulSoup(text, features="lxml")
    form = {}
    for inputtag in soup.find_all(re.compile("(INPUT|input)")):
        name = inputtag.get("name", "")
        value = inputtag.get("value", "")
        form[name] = value
    return form