code: def addPyFile(self, path):
          
          self.addFile(path)
          (dirname, filename) = os.path.split(path)  # dirname may be directory or HDFS/S3 prefix
          if filename[-4:].lower() in self.PACKAGE_EXTENSIONS:
              self._python_includes.append(filename)
              # for tests in local mode
              sys.path.insert(1, os.path.join(SparkFiles.getRootDirectory(), filename))
          if sys.version > '3':
              import importlib
              importlib.invalidate_caches()
docs: Add a .py or .zip dependency for all tasks to be executed on this
          SparkContext in the future.  The C{path} passed can be either a local
          file, a file in HDFS (or other Hadoop-supported filesystems), or an
          HTTP, HTTPS or FTP URI.
  
          .. note:: A path can be added only once. Subsequent additions of the same path are ignored.