docs: def get_content_type(name, content):
      """
      Checks if the content_type is already set.
      Otherwise uses the mimetypes library to guess.
      """
      if hasattr(content, "content_type"):
          content_type = content.content_type
      else:
          mime_type, encoding = mimetypes.guess_type(name)
          content_type = mime_type
      return content_type