def map_to_dictionary(self, url, obj, **kwargs):
maxwidth = kwargs.get('<STR_LIT>', None)<EOL>maxheight = kwargs.get('<STR_LIT>', None)<EOL>provider_url, provider_name = self.provider_from_url(url)<EOL>mapping = {<EOL>'<STR_LIT:version>': '<STR_LIT:1.0>',<EOL>'<STR_LIT:url>': url,<EOL>'<STR_LIT>': provider_name,<EOL>'<STR_LIT>': provider_url,<EOL>'<STR_LIT:type>': self.resource_type<EOL>}<EOL>self.preprocess(obj, mapping, **kwargs)<EOL>if self.resource_type == '<STR_LIT>' and self.get_image(obj):<EOL><INDENT>self.resize_photo(obj, mapping, maxwidth, maxheight)<EOL><DEDENT>elif self.resource_type in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>width, height = size_to_nearest(<EOL>maxwidth,<EOL>maxheight,<EOL>self._meta.valid_sizes,<EOL>self._meta.force_fit<EOL>)<EOL>mapping.update(width=width, height=height)<EOL><DEDENT>if self.get_image(obj):<EOL><INDENT>self.thumbnail(obj, mapping)<EOL><DEDENT>for attr in ('<STR_LIT:title>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:html>'):<EOL><INDENT>self.map_attr(mapping, attr, obj)<EOL><DEDENT>if '<STR_LIT:url>' in mapping:<EOL><INDENT>mapping['<STR_LIT:url>'] = relative_to_full(mapping['<STR_LIT:url>'], url)<EOL><DEDENT>if '<STR_LIT>' in mapping:<EOL><INDENT>mapping['<STR_LIT>'] = relative_to_full(mapping['<STR_LIT>'], url)<EOL><DEDENT>if '<STR_LIT:html>' not in mapping and mapping['<STR_LIT:type>'] in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>mapping['<STR_LIT:html>'] = self.render_html(obj, context=Context(mapping))<EOL><DEDENT>self.postprocess(obj, mapping, **kwargs)<EOL>return mapping<EOL>
Build a dictionary of metadata for the requested object.