Returns *content* wrapped in `<p>` tags.

  If *hard_breaks* is `True`, all line breaks are converted to `<br />` tags.

def build_paragraph(content, hard_breaks=False):
  """
  Returns *content* wrapped in `<p>` tags.

  If *hard_breaks* is `True`, all line breaks are converted to `<br />` tags.

  """
  lines = list(filter(None, [line.strip() for line in content.split('\n')]))
  if hard_breaks:
    for line_number in range(len(lines) - 1):
      lines[line_number] = "{}<br />".format(lines[line_number])
  return "<p>{}</p>".format('\n'.join(lines))