code: def get_dependencies(pefile):
    
  
    # Check if we already analyzed this file before.
    hasher = hashlib.sha1(os.path.normpath(pefile).encode('utf8'))
    cachefile = hasher.hexdigest() + '_' + os.path.basename(pefile) + '-deps.csv'
    cachefile = os.path.join(CACHE_DIR, cachefile)
  
    if nr.path.compare_timestamp(pefile, cachefile):
      # Cachefile doesn't exist or is older than changes to pefile.
      logger.info('Analyzing "{}" ...'.format(pefile))
      nr.path.makedirs(os.path.dirname(cachefile))
  
      command = [get_dependency_walker(), '/c', '/oc:' + cachefile, pefile]
      logger.debug('Running command: {}'.format(command))
      code = subprocess.call(command)
  
      if code > 0x00010000:  # Processing error and no work was done
        raise RuntimeError('Dependency Walker exited with non-zero returncode {}.'.format(code))
  
    else:
      logger.info('Using cached dependency information for "{}"'.format(pefile))
  
    result = []
    with io.open(cachefile) as src:
      src.readline()  # header
      for line in csv.reader(src):
        dep = Dependency(line[1])
        if dep.name.lower()[:6] in ('api-ms', 'ext-ms'):
          continue
        result.append(dep)
  
    return result
docs: Uses Dependency Walker to get a list of dependencies for the specified
    PE file (a Windows executable or dynamic link library).