code: def to_comment(comment):
      
      return '#' + re.sub(r'[^\x00-\xFF]', _esc,
                          re.sub(r'\n(?![#!])', '\n#',
                                 re.sub(r'\r\n?', '\n', comment)))
docs: Convert a string to a ``.properties`` file comment.  All non-Latin-1
      characters in the string are escaped using ``\\uXXXX`` escapes (after
      converting non-BMP characters to surrogate pairs), a ``#`` is prepended to
      the string, any CR LF or CR line breaks in the string are converted to LF,
      and a ``#`` is inserted after any line break not already followed by a
      ``#`` or ``!``.  No trailing newline is added.
  
      >>> to_comment('They say foo=bar,\\r\\nbut does bar=foo?')
      '#They say foo=bar,\\n#but does bar=foo?'
  
      :param comment: the string to convert to a comment
      :type comment: text string
      :rtype: text string