code: def check_package_dir(dir, package_names):
      for dirname in package_names:
          dir = os.path.join(dir, dirname)
          if not is_package_dir(dir):
              return None
      return dir
  
imports: from __future__ import absolute_import
  import os
  import sys
  import re
  import io
  import codecs
  import shutil
  import tempfile
  from contextlib import contextmanager
label_desc: Use image node_id 11 for calling a global function with example usage: check_package_dir(dir, package_names) and returns: dir, None