def _get_margin_width(self, cli, margin):
        """
        Return the width for this margin.
        (Calculate only once per render time.)
        """
        # Margin.get_width, needs to have a UIContent instance.
        def get_ui_content():
            return self._get_ui_content(cli, width=0, height=0)

        def get_width():
            return margin.get_width(cli, get_ui_content)

        key = (margin, cli.render_counter)
        return self._margin_width_cache.get(key, get_width)
Return the width for this margin.
        (Calculate only once per render time.)