def METHOD_NAME(self, part_names):
    for part_name in part_names:
        if part_name not in self._part_names:
            raise snapcraft_legacy.internal.errors.SnapcraftEnvironmentError(
                "The part named {!r} is not defined in "
                "{!r}".format(
                    part_name, self._project.info.snapcraft_yaml_file_path
                )
            )