def get_favicon(self, size, rel, update=False):
fav, _ = FaviconImg.objects.get_or_create(<EOL>faviconFK=self, size=size, rel=rel)<EOL>if update and fav.faviconImage:<EOL><INDENT>fav.del_image()<EOL><DEDENT>if self.faviconImage and not fav.faviconImage:<EOL><INDENT>tmp = Image.open(storage.open(self.faviconImage.name))<EOL>tmp.thumbnail((size, size), Image.ANTIALIAS)<EOL>tmpIO = BytesIO()<EOL>tmp.save(tmpIO, format='<STR_LIT>')<EOL>tmpFile = InMemoryUploadedFile(<EOL>tmpIO, None, '<STR_LIT>' %<EOL>(size,), '<STR_LIT>', sys.getsizeof(tmpIO), None)<EOL>fav.faviconImage = tmpFile<EOL>fav.save()<EOL><DEDENT>return fav<EOL>
get or create a favicon for size, rel(attr) and uploaded favicon
optional:
    update=True