def encode_record(self, record):
      """Converts the record to bytes.

      Since csv writer only supports Unicode for PY3, we need to convert them
      conditionally before calling csv writer. We always return result in bytes
      format to be consistent with current behavior.

      Args:
        record: The data to be converted.

      Returns:
        Bytes representation input.
      """
      self._writer.writerow([_to_string(x) for x in record])
      result = tf.compat.as_bytes(self._buffer.getvalue())
      # Reset the buffer.
      self._buffer.seek(0)
      self._buffer.truncate(0)
      return result
Converts the record to bytes.

      Since csv writer only supports Unicode for PY3, we need to convert them
      conditionally before calling csv writer. We always return result in bytes
      format to be consistent with current behavior.

      Args:
        record: The data to be converted.

      Returns:
        Bytes representation input.
      
tensorflow_transform/coders/csv_coder.py