Converts the given data element into a string representation using
        the :method:`data_to_string` method and encodes the resulting
        text with the given encoding.

def data_to_bytes(self, data_element, encoding=None):
        """
        Converts the given data element into a string representation using
        the :method:`data_to_string` method and encodes the resulting
        text with the given encoding.
        """
        if encoding is None:
            encoding = self.encoding
        text = self.data_to_string(data_element)
        return bytes_(text, encoding=encoding)