def render_oembed(self, oembed_resource, original_url, template_dir=None,<EOL>context=None):
provided_context = context or Context()<EOL>context = RequestContext(context.get("<STR_LIT>") or mock_request())<EOL>context.update(provided_context)<EOL>template_name = '<STR_LIT>' % oembed_resource.type<EOL>templates = [os.path.join('<STR_LIT>', template_name), '<STR_LIT>']<EOL>if template_dir:<EOL><INDENT>templates.insert(<NUM_LIT:0>, os.path.join('<STR_LIT>', template_dir, template_name))<EOL><DEDENT>template = select_template(templates)<EOL>context.push()<EOL>context['<STR_LIT>'] = oembed_resource<EOL>context['<STR_LIT>'] = original_url<EOL>rendered = template.render(context)<EOL>context.pop()<EOL>return rendered.strip()<EOL>
Render the oembed resource and return as a string.

Template directory will always fall back to 'oembed/[type].html', but
a custom template dir can be passed in using the kwargs.

Templates are given two context variables:
- response: an OEmbedResource
- original_url: the url that was passed to the consumer