def METHOD_NAME(item):
    id = re.search(r'id="([a-zA-Z0-9_-]+)"', item.text)
    if id:
        return id.group(1)
    try:
        id = item.next_element.attrs["name"]
    except:
        id = None
    return id