def repr_with_newlines(string):
    """
  return the string, passed through repr(), but with
  newlines intact.

  Thus the string "new
line" becomes not "new\\nline" but instead
  a string with a literal newline in it: '''new
line'''
  """
    if '\n' not in string:
        return repr(string)
    else:
        reprd = repr(string)
        quote_type = reprd[0]
        newlines_returned = reprd.replace('\\n', '\n')
        multiline_quotes = quote_type * 2 + newlines_returned + quote_type * 2
        return multiline_quotes
