code: def extract_iface_name_from_path(path, name):
      
      if name in path:
          ifname = os.path.basename(path).split("_", 2)[-1].strip()
          if "." in ifname or "macvtap" in ifname or "macvlan" in ifname:
              ifname = ifname.replace("_", "@")
          return ifname
docs: Extract the 'real' interface name from the path name.  Basically this
      puts the '@' back in the name in place of the underscore, where the name
      contains a '.' or contains 'macvtap' or 'macvlan'.
  
      Examples:
  
      +------------------+-----------------+
      | real name        | path name       |
      +==================+=================+
      | bond0.104\@bond0 | bond0.104_bond0 |
      +------------------+-----------------+
      | __tmp1111        | __tmp1111       |
      +------------------+-----------------+
      | macvtap\@bond0   | macvlan_bond0   |
      +------------------+-----------------+
      | prod_bond        | prod_bond       |
      +------------------+-----------------+