<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def duplicate(self, name=None, location=None):
 """ Duplicate a project It's the save as feature of the 1.X. It's implemented on top of the export / import features. It will generate a gns3p and reimport it. It's a little slower but we have only one implementation to maintain. :param name: Name of the new project. A new one will be generated in case of conflicts :param location: Parent directory of the new project """

        # If the project was not open we open it temporary
        previous_status = self._status
        if self._status == "closed":
            yield from self.open()

        self.dump()
        try:
            with tempfile.TemporaryDirectory() as tmpdir:
                zipstream = yield from export_project(self, tmpdir, keep_compute_id=True, allow_all_nodes=True)
                with open(os.path.join(tmpdir, "project.gns3p"), "wb") as f:
                    for data in zipstream:
                        f.write(data)
                with open(os.path.join(tmpdir, "project.gns3p"), "rb") as f:
                    project = yield from import_project(self._controller, str(uuid.uuid4()), f, location=location, name=name, keep_compute_id=True)
        except (OSError, UnicodeEncodeError) as e:
            raise aiohttp.web.HTTPConflict(text="Can not duplicate project: {}".format(str(e)))

        if previous_status == "closed":
            yield from self.close()

        return project