code: def reads(text, fmt, as_version=4, **kwargs):
      
      fmt = copy(fmt)
      fmt = long_form_one_format(fmt)
      ext = fmt['extension']
  
      if ext == '.ipynb':
          return nbformat.reads(text, as_version, **kwargs)
  
      format_name = read_format_from_metadata(text, ext) or fmt.get('format_name')
  
      if format_name:
          format_options = {}
      else:
          format_name, format_options = guess_format(text, ext)
  
      if format_name:
          fmt['format_name'] = format_name
  
      fmt.update(format_options)
      reader = TextNotebookConverter(fmt)
      notebook = reader.reads(text, **kwargs)
      rearrange_jupytext_metadata(notebook.metadata)
  
      if format_name and insert_or_test_version_number():
          notebook.metadata.setdefault('jupytext', {}).setdefault('text_representation', {}).update(
              {'extension': ext, 'format_name': format_name})
  
      return notebook
docs: Read a notebook from a string