def parse_intf_section(interface):
interface = interface.strip()<EOL>re_protocol = r"<STR_LIT>"r"<STR_LIT>"<EOL>re_intf_name_state = r"<STR_LIT>"<EOL>re_is_enabled_1 = r"<STR_LIT>"<EOL>re_is_enabled_2 = r"<STR_LIT>"<EOL>re_is_enabled_3 = r"<STR_LIT>"<EOL>re_mac = r"<STR_LIT>"<EOL>re_speed = r"<STR_LIT>"<EOL>re_description = r"<STR_LIT>"<EOL>match = re.search(re_protocol, interface, flags=re.M)<EOL>if match:<EOL><INDENT>intf_name = match.group('<STR_LIT>')<EOL>status = match.group('<STR_LIT:status>')<EOL>protocol = match.group('<STR_LIT>')<EOL>if '<STR_LIT>' in status.lower():<EOL><INDENT>is_enabled = False<EOL><DEDENT>else:<EOL><INDENT>is_enabled = True<EOL><DEDENT>is_up = bool('<STR_LIT>' in protocol)<EOL><DEDENT>else:<EOL><INDENT>match = re.search(re_intf_name_state, interface)<EOL>intf_name = match.group('<STR_LIT>')<EOL>intf_state = match.group('<STR_LIT>').strip()<EOL>is_up = True if intf_state == '<STR_LIT>' else False<EOL>admin_state_present = re.search("<STR_LIT>", interface)<EOL>if admin_state_present:<EOL><INDENT>for x_pattern in [re_is_enabled_1, re_is_enabled_2]:<EOL><INDENT>match = re.search(x_pattern, interface, flags=re.M)<EOL>if match:<EOL><INDENT>is_enabled = match.group('<STR_LIT>').strip()<EOL>is_enabled = True if is_enabled == '<STR_LIT>' else False<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>msg = "<STR_LIT>".format(interface)<EOL>raise ValueError(msg)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>is_enabled = True<EOL>if not is_up:<EOL><INDENT>match = re.search(re_is_enabled_3, interface, flags=re.M)<EOL>if match:<EOL><INDENT>is_enabled = False<EOL><DEDENT><DEDENT><DEDENT><DEDENT>match = re.search(re_mac, interface, flags=re.M)<EOL>if match:<EOL><INDENT>mac_address = match.group('<STR_LIT>')<EOL>mac_address = napalm_base.helpers.mac(mac_address)<EOL><DEDENT>else:<EOL><INDENT>mac_address = "<STR_LIT>"<EOL><DEDENT>match = re.search(re_speed, interface, flags=re.M)<EOL>speed = int(match.group('<STR_LIT>'))<EOL>speed_unit = match.group('<STR_LIT>')<EOL>if speed_unit != "<STR_LIT>":<EOL><INDENT>msg = "<STR_LIT>".format(interface)<EOL>raise ValueError(msg)<EOL><DEDENT>speed = int(round(speed / <NUM_LIT>))<EOL>description = '<STR_LIT>'<EOL>match = re.search(re_description, interface, flags=re.M)<EOL>if match:<EOL><INDENT>description = match.group('<STR_LIT:description>')<EOL><DEDENT>return {<EOL>intf_name: {<EOL>'<STR_LIT:description>': description,<EOL>'<STR_LIT>': is_enabled,<EOL>'<STR_LIT>': is_up,<EOL>'<STR_LIT>': -<NUM_LIT:1.0>,<EOL>'<STR_LIT>': mac_address,<EOL>'<STR_LIT>': speed}<EOL>}<EOL>
Parse a single entry from show interfaces output.

    Different cases:
    mgmt0 is up
    admin state is up

    Ethernet2/1 is up
    admin state is up, Dedicated Interface

    Vlan1 is down (Administratively down), line protocol is down, autostate enabled

    Ethernet154/1/48 is up (with no 'admin state')