code: def _find_mac_near_keyword(command, args, keywords, get_word_index):
      """Searches a command's output for a MAC address near a keyword.
  
      Each line of words in the output is case-insensitively searched for
      any of the given keywords.  Upon a match, get_word_index is invoked
      to pick a word from the line, given the index of the match.  For
      example, lambda i: 0 would get the first word on the line, while
      lambda i: i - 1 would get the word preceding the keyword.
      """
      stdout = _get_command_stdout(command, args)
      if stdout is None:
          return None
  
      first_local_mac = None
      for line in stdout:
          words = line.lower().rstrip().split()
          for i in range(len(words)):
              if words[i] in keywords:
                  try:
                      word = words[get_word_index(i)]
                      mac = int(word.replace(_MAC_DELIM, b""), 16)
                  except (ValueError, IndexError):
                      # Virtual interfaces, such as those provided by
                      # VPNs, do not have a colon-delimited MAC address
                      # as expected, but a 16-byte HWAddr separated by
                      # dashes. These should be ignored in favor of a
                      # real MAC address
                      pass
                  else:
                      if _is_universal(mac):
                          return mac
                      first_local_mac = first_local_mac or mac
      return first_local_mac or None
  
imports: import os
  import sys
  from enum import Enum, _simple_enum
label_desc: Use image node_id 3 for calling a global function with example usage: _find_mac_near_keyword(command, args, keywords, get_word_index) and returns: unknown, None, mac