code: def get_file_mode_for_reading(context):
      
      format = context['tar'].get('format', None)
  
      if format or format == '':
          mode = f"r:{context.get_formatted_string(format)}"
      else:
          mode = 'r:*'
  
      return mode
docs: Get file mode for reading from tar['format'].
  
      This should return r:*, r:gz, r:bz2 or r:xz. If user specified something
      wacky in tar.Format, that's their business.
  
      In theory r:* will auto-deduce the correct format.