def METHOD_NAME(self):
    if self._obj.has_metadata():
        self._lines.add_line('Metadata:')
        # Python 3 doesn't allow sorting of mixed types so we can't just
        # use sorted() on the metadata keys. Sort first by type then sort
        # by value within each type.
        for key in self._sorted_keys_grouped_by_type(self._obj.metadata):
            value = self._obj.metadata[key]
            self._lines.add_lines(
                self._format_metadata_key_value(key, value))