docs: def get_metadata(self, digest, content, mime_type):
          """Get a dictionary representing the metadata embedded in the given
          content."""
  
          # XXX: ad-hoc for now, refactor later
          if mime_type.startswith("image/"):
              img = Image.open(BytesIO(content))
              ret = {}
              if not hasattr(img, "_getexif"):
                  return {}
              info = img._getexif()
              if not info:
                  return {}
              for tag, value in info.items():
                  decoded = TAGS.get(tag, tag)
                  ret["EXIF:" + str(decoded)] = value
              return ret
          else:
              if mime_type != "application/pdf":
                  content = self.to_pdf(digest, content, mime_type)
  
              with make_temp_file(content) as in_fn:
                  try:
                      output = subprocess.check_output(["pdfinfo", in_fn])
                  except OSError:
                      logger.error("Conversion failed, probably pdfinfo is not installed")
                      raise
  
              ret = {}
              for line in output.split(b"\n"):
                  if b":" in line:
                      key, value = line.strip().split(b":", 1)
                      key = str(key)
                      ret["PDF:" + key] = str(value.strip(), errors="replace")
  
              return ret