def to_comment ( value ) : if value is None : return if len ( value . split ( '\n' ) ) == 1 : return "* " + value else : return '\n' . join ( [ ' * ' + l for l in value . split ( '\n' ) [ : - 1 ] ] )
how to represent comments in python
Builds a comment .
def to_comment(value):
  """
  Builds a comment.
  """
  if value is None:
    return
  if len(value.split('\n')) == 1:
    return "* " + value
  else:
    return '\n'.join([' * ' + l for l in value.split('\n')[:-1]])