<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_rust_extensions(*directories, **kwargs):
 """Attempt to find Rust extensions in given directories. This function will recurse through the directories in the given directories, to find a name whose name is ``libfile``. When such a file is found, an extension is created, expecting the cargo manifest file (``Cargo.toml``) to be next to that file. The extension destination will be deduced from the name of the directory where that ``libfile`` is contained. Arguments: directories (list, *optional*):
 a list of directories to walk through recursively to find extensions. If none are given, then the current directory will be used instead. Keyword Arguments: libfile (str):
 the name of the file to look for when searching for Rust extensions. Defaults to ``lib.rs``, but might be changed to allow defining more *Pythonic* filenames (like ``__init__.rs``)! Note: All other keyword arguments will be directly passed to the `RustExtension` instance created when an extension is found. One may be interested in passing ``bindings`` and ``strip`` options:: Example: Consider the following project:: lib/ └ mylib/ └ rustext/ ├ lib.rs └ Cargo.toml setup.py There is only one extension that can be found in the ``lib`` module:: lib.mylib.rustext => lib/mylib/rustext/Cargo.toml """


    # Get the file used to mark a Rust extension
    libfile = kwargs.get("libfile", "lib.rs")

    # Get the directories to explore
    directories = directories or [os.getcwd()]

    extensions = []
    for directory in directories:
        for base, dirs, files in os.walk(directory):
            if libfile in files:
                dotpath = os.path.relpath(base).replace(os.path.sep, ".")
                tomlpath = os.path.join(base, "Cargo.toml")
                ext = RustExtension(dotpath, tomlpath, **kwargs)
                ext.libfile = os.path.join(base, libfile)
                extensions.append(ext)

    return extensions