parameters: (configured_ifs)
return_statement: return None
docstring: try to return a right interface so that iftop can listen on
docstring_summary: try to return a right interface so that iftop can listen on
docstring_tokens: try to return a right interface so that iftop can listen on
function: def try_to_get_right_interface(configured_ifs):
      """ try to return a right interface so that iftop can listen on """
      ifs = get_interfaces()
  
      logger.debug("found interfaces %s", ifs)
  
      for interface in configured_ifs.split(","):
          interface = interface.strip()
          if interface in ifs:
              return interface
  
      logger.info("didn't find correct network interface in this node, configured %s, found %s",
              configured_ifs, ifs)
  
      ip = get_ip_can_access_internet()
      if ip is not None:
          for if_name, if_ip in ifs.items():
              if ip == if_ip:
                  return if_name
  
      return None
function_tokens: def try_to_get_right_interface ( configured_ifs ) : ifs = get_interfaces ( ) logger . debug ( "found interfaces %s" , ifs ) for interface in configured_ifs . split ( "," ) : interface = interface . strip ( ) if interface in ifs : return interface logger . info ( "didn't find correct network interface in this node, configured %s, found %s" , configured_ifs , ifs ) ip = get_ip_can_access_internet ( ) if ip is not None : for if_name , if_ip in ifs . items ( ) : if ip == if_ip : return if_name return None