docs: def register_backend(mimetype, module, extensions=None):
      """Register a backend.
      `mimetype`: a mimetype string (e.g. 'text/plain')
      `module`: an import string (e.g. path.to.my.module)
      `extensions`: a list of extensions (e.g. ['txt', 'text'])
      """
      if mimetype in MIMETYPE_TO_BACKENDS:
          warn("overwriting %r mimetype which was already set" % mimetype)
      MIMETYPE_TO_BACKENDS[mimetype] = module
      if extensions is None:
          try:
              ext = _MIMETYPES_TO_EXT[mimetype]
          except KeyError:
              raise KeyError(
                  "mimetypes module has no extension associated "
                  "with %r mimetype; use 'extensions' arg yourself" % mimetype)
          assert ext, ext
          EXTS_TO_MIMETYPES[ext] = mimetype
      else:
          if not isinstance(extensions, (list, tuple, set, frozenset)):
              raise TypeError("invalid extensions type (got %r)" % extensions)
          for ext in set(extensions):
              ext = ext if ext.startswith('.') else '.' + ext
              assert ext, ext
              EXTS_TO_MIMETYPES[ext] = mimetype