def get_elem_type(elem):
    """ Get elem type of soup selection
        :param elem: a soup element
    """
    elem_type = None
    if isinstance(elem, list):
        if elem[0].get("type") == "radio":
            elem_type = "radio"
        else:
            raise ValueError(u"Unknown element type: {}".format(elem))

    elif elem.name == "select":
        elem_type = "select"

    elif elem.name == "input":
        elem_type = elem.get("type")

    else:
        raise ValueError(u"Unknown element type: {}".format(elem))

    # To be removed
    assert elem_type is not None

    return elem_type
def get_elem_type ( elem ) : elem_type = None if isinstance ( elem , list ) : if elem [ 0 ] . get ( "type" ) == "radio" : elem_type = "radio" else : raise ValueError ( u"Unknown element type: {}" . format ( elem ) ) elif elem . name == "select" : elem_type = "select" elif elem . name == "input" : elem_type = elem . get ( "type" ) else : raise ValueError ( u"Unknown element type: {}" . format ( elem ) ) assert elem_type is not None return elem_type
Get elem type of soup selection
        :param elem: a soup element