code: def get_cython_extensions(srcdir, packages, prevextensions=tuple(),
                            extincludedirs=None):
      
  
      # Vanilla setuptools and old versions of distribute include Cython files
      # as .c files in the sources, not .pyx, so we cannot simply look for
      # existing .pyx sources in the previous sources, but we should also check
      # for .c files with the same remaining filename. So we look for .pyx and
      # .c files, and we strip the extension.
      prevsourcepaths = []
      ext_modules = []
  
      for ext in prevextensions:
          for s in ext.sources:
              if s.endswith(('.pyx', '.c', '.cpp')):
                  sourcepath = os.path.realpath(os.path.splitext(s)[0])
                  prevsourcepaths.append(sourcepath)
  
      for package_name in packages:
          package_parts = package_name.split('.')
          package_path = os.path.join(srcdir, *package_parts)
  
          for extmod, pyxfn in iter_pyx_files(package_path, package_name):
              sourcepath = os.path.realpath(os.path.splitext(pyxfn)[0])
              if sourcepath not in prevsourcepaths:
                  ext_modules.append(Extension(extmod, [pyxfn],
                                               include_dirs=extincludedirs))
  
      return ext_modules
docs: Looks for Cython files and generates Extensions if needed.
  
      Parameters
      ----------
      srcdir : str
          Path to the root of the source directory to search.
      prevextensions : list of `~distutils.core.Extension` objects
          The extensions that are already defined.  Any .pyx files already here
          will be ignored.
      extincludedirs : list of str or None
          Directories to include as the `include_dirs` argument to the generated
          `~distutils.core.Extension` objects.
  
      Returns
      -------
      exts : list of `~distutils.core.Extension` objects
          The new extensions that are needed to compile all .pyx files (does not
          include any already in `prevextensions`).