<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def render_pdf(html, stylesheets=None, download_filename=None, automatic_download=True):
 """Render a PDF to a response with the correct ``Content-Type`` header. :param html: Either a :class:`weasyprint.HTML` object or an URL to be passed to :func:`flask_weasyprint.HTML`. The latter case requires a request context. :param stylesheets: A list of user stylesheets, passed to :meth:`~weasyprint.HTML.write_pdf` :param download_filename: If provided, the ``Content-Disposition`` header is set so that most web browser will show the "Save as…" dialog with the value as the default filename. :param automatic_download: If True, the browser will automatic download file. :returns: a :class:`flask.Response` object. """

    if not hasattr(html, 'write_pdf'):
        html = HTML(html)
    pdf = html.write_pdf(stylesheets=stylesheets)
    response = current_app.response_class(pdf, mimetype='application/pdf')
    if download_filename:
        if automatic_download:
            value = 'attachment'
        else:
            value = 'inline'
        response.headers.add('Content-Disposition', value,
                             filename=download_filename)
    return response