<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def env_updated(self, kb_app, sphinx_app: Sphinx, sphinx_env: BuildEnvironment, resource ):
 """ Make images and enter them in Sphinx's output writer """


        docname = resource.docname
        srcdir = sphinx_app.env.srcdir
        source_imgpath = self.source_filename(docname, srcdir)

        # Copy the image to the Sphinx build directory
        build_dir = sphinx_app.outdir
        docpath = Path(docname)
        parent = docpath.parent
        target_imgpath = str(Path(build_dir, parent, self.filename))

        # Does the target dir exist yet in the build dir? Probably not. If
        # not, make it
        target_dir = Path(build_dir, parent)
        if not target_dir.exists():
            target_dir.mkdir(parents=True, exist_ok=True)

        shutil.copy(source_imgpath, target_imgpath)