def _serialize()

in src/cloudformation_cli_python_lib/interface.py [0:0]


    def _serialize(self) -> MutableMapping[str, Any]:
        # to match Java serialization, which drops `null` values, and the
        # contract tests currently expect this also
        ser = {k: v for k, v in self.__dict__.items() if v is not None}

        # mutate to what's expected in the response

        ser["status"] = ser.pop("status").name

        if self.resourceModel:
            # pylint: disable=protected-access
            ser["resourceModel"] = self.resourceModel._serialize()
        if self.resourceModels:
            ser["resourceModels"] = [
                # pylint: disable=protected-access
                model._serialize()
                for model in self.resourceModels
            ]
        if self.errorCode:
            ser["errorCode"] = self.errorCode.name
        return ser