Returns *content* wrapped in a HTML structure.

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

def wrap_content(content, settings, hard_breaks=False):
  """
  Returns *content* wrapped in a HTML structure.

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

  """
  settings.context['content'] = wrap_paragraphs(content, hard_breaks)
  template = Template(settings.template)
  try:
    return template.render(**settings.context)
  except KeyError as error:
    msg = "missing context setting: {}".format(error)
    raise ContextError(msg)