code: def format_from_extension(fname):
      
      _base, ext = os.path.splitext(fname)
      if not ext:
          return None
      try:
          format = known_extensions[ext.replace('.', '')]
      except KeyError:
          format = None
      return format
docs: Tries to infer a protocol from the file extension.