<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_code(code, filetype, pygments_style):
 """Renders a piece of code into HTML. Highlights syntax if filetype is specfied"""

    if filetype:
        lexer = pygments.lexers.get_lexer_by_name(filetype)
        formatter = pygments.formatters.HtmlFormatter(style=pygments_style)
        return pygments.highlight(code, lexer, formatter)
    else:
        return "<pre><code>{}</code></pre>".format(code)